HackMD/lib/migrations/20160420180355-note-add-alias.js
BoHong Li e26bb0503f fix: Support SQlite
Move 'unique' constraint to another statement (SQLite don't support set unique when addColumn)
2017-03-28 15:16:09 +08:00

19 lines
495 B
JavaScript

'use strict'
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.addColumn('Notes', 'alias', {
type: Sequelize.STRING
}).then(function () {
return queryInterface.addIndex('Notes', ['alias'], {
indicesType: 'UNIQUE'
})
})
},
down: function (queryInterface, Sequelize) {
return queryInterface.removeColumn('Notes', 'alias').then(function () {
return queryInterface.removeIndex('Notes', ['alias'])
})
}
}