2017-03-27 07:23:00 -04:00
|
|
|
'use strict'
|
2020-04-19 07:31:44 -04:00
|
|
|
function isSQLite (sequelize) {
|
|
|
|
return sequelize.options.dialect === 'sqlite'
|
|
|
|
}
|
|
|
|
|
2017-03-27 07:23:00 -04:00
|
|
|
module.exports = {
|
2020-06-02 07:48:38 -04:00
|
|
|
up: async function (queryInterface, Sequelize) {
|
2017-03-27 07:23:00 -04:00
|
|
|
return queryInterface.changeColumn('Notes', 'title', {
|
|
|
|
type: Sequelize.TEXT
|
2017-03-28 03:16:09 -04:00
|
|
|
}).then(function () {
|
2017-03-28 03:25:36 -04:00
|
|
|
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
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2020-06-02 07:48:38 -04:00
|
|
|
down: async function (queryInterface, Sequelize) {
|
2017-03-27 07:23:00 -04:00
|
|
|
return queryInterface.changeColumn('Notes', 'title', {
|
|
|
|
type: Sequelize.STRING
|
2017-03-28 03:16:09 -04:00
|
|
|
}).then(function () {
|
2017-03-28 03:25:36 -04:00
|
|
|
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
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|