mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-26 10:00:50 +08:00
e55c36a79a
Summary: This diff adds support for database migration to our cloud API. It's partially inspired by Halla's local-sync migration diff (D3809). You can run a migration by calling "node-babel scripts/migrate-db up|down" or by calling "npm script upgrade-db|downgrade-db". Note that for simplicity reasons we assume that we're only writing migrations for our MySQL database – people developing locally may have to blow up there dbs whenever there's a schema change, though in practice `ALTER TABLE ADD COLUMN`statements work the same on both dbs. Test Plan: Tested locally. Will run the metadata migration on staging. Reviewers: evan, spang, halla Reviewed By: halla Differential Revision: https://phab.nylas.com/D3840
11 lines
395 B
JavaScript
11 lines
395 B
JavaScript
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
const {sequelize} = queryInterface;
|
|
console.log("querying db");
|
|
await sequelize.query("ALTER TABLE metadata ADD COLUMN `expiration` DATETIME");
|
|
},
|
|
down: async (queryInterface, Sequelize) => {
|
|
const {sequelize} = queryInterface;
|
|
await sequelize.query("ALTER TABLE metadata DROP COLUMN `expiration`");
|
|
},
|
|
}
|