HackMD/lib/migrations/20150915153700-change-notes-title-to-text.js

26 lines
768 B
JavaScript
Raw Normal View History

2017-03-27 11:23:00 +00:00
'use strict'
const isSQLite = require('../utils').isSQLite
2017-03-27 11:23:00 +00:00
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'])
}
2017-03-27 11:23:00 +00:00
})
},
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'])
}
2017-03-27 11:23:00 +00:00
})
}
}