codimd/lib/migrations/20150915153700-change-notes-title-to-text.ts
Raccoon 147c20064f
ts: all migrations
Signed-off-by: Raccoon <raccoon@hackmd.io>
2021-06-16 18:35:28 +08:00

26 lines
737 B
TypeScript

import {isSQLite} from "../utils";
export = {
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'])
}
})
}
}