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

29 lines
817 B
JavaScript
Raw Normal View History

2017-03-27 07:23:00 -04:00
'use strict'
function isSQLite (sequelize) {
return sequelize.options.dialect === 'sqlite'
}
2017-03-27 07:23:00 -04:00
module.exports = {
up: async function (queryInterface, Sequelize) {
2017-03-27 07:23:00 -04:00
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 07:23:00 -04:00
})
},
down: async function (queryInterface, Sequelize) {
2017-03-27 07:23:00 -04:00
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 07:23:00 -04:00
})
}
}