diff options
Diffstat (limited to 'lib/migrations/20150915153700-change-notes-title-to-text.js')
-rw-r--r-- | lib/migrations/20150915153700-change-notes-title-to-text.js | 25 |
1 files changed, 25 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 new file mode 100644 index 00000000..9d00f15f --- /dev/null +++ b/lib/migrations/20150915153700-change-notes-title-to-text.js @@ -0,0 +1,25 @@ +'use strict' +const isSQLite = require('../utils').isSQLite +module.exports = { + up: function (queryInterface, Sequelize) { + return queryInterface.changeColumn('Notes', 'title', { + type: Sequelize.TEXT + }).then(function () { + if (isSQLite(queryInterface.sequelize)) { + // 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 () { + if (isSQLite(queryInterface.sequelize)) { + // manual added index will be removed in sqlite + return queryInterface.addIndex('Notes', ['shortid']) + } + }) + } +} |