summaryrefslogtreecommitdiff
path: root/lib/migrations/20150915153700-change-notes-title-to-text.js
diff options
context:
space:
mode:
authorBoHong Li2017-03-28 15:16:09 +0800
committerBoHong Li2017-03-28 15:16:09 +0800
commite26bb0503f962e1ee56dfa138b43af4653065812 (patch)
tree32703ec0cb7ad9050e107da9d2dff60f59554f16 /lib/migrations/20150915153700-change-notes-title-to-text.js
parent6f14822413eeb43aae1298163699f87bc1ce11e7 (diff)
fix: Support SQlite
Move 'unique' constraint to another statement (SQLite don't support set unique when addColumn)
Diffstat (limited to 'lib/migrations/20150915153700-change-notes-title-to-text.js')
-rw-r--r--lib/migrations/20150915153700-change-notes-title-to-text.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/migrations/20150915153700-change-notes-title-to-text.js b/lib/migrations/20150915153700-change-notes-title-to-text.js
index 6f7307d1..2b3a82bf 100644
--- a/lib/migrations/20150915153700-change-notes-title-to-text.js
+++ b/lib/migrations/20150915153700-change-notes-title-to-text.js
@@ -3,12 +3,17 @@ module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.changeColumn('Notes', 'title', {
type: Sequelize.TEXT
+ }).then(function () {
+ // manual added index will be removed in sqlite
+ return queryInterface.addIndex('Notes', ['shortid'])
})
},
down: function (queryInterface, Sequelize) {
return queryInterface.changeColumn('Notes', 'title', {
type: Sequelize.STRING
+ }).then(function () {
+ return queryInterface.addIndex('Notes', ['shortid'])
})
}
}