From 0f6193b4500692c906ca3d4cf93b54f15eadb672 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 25 Jul 2018 14:25:40 -0700 Subject: [PATCH] added migration for db --- .../File_AddHeightAndWidthColumn.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 server/migrations/File_AddHeightAndWidthColumn.js diff --git a/server/migrations/File_AddHeightAndWidthColumn.js b/server/migrations/File_AddHeightAndWidthColumn.js new file mode 100644 index 00000000..03aad049 --- /dev/null +++ b/server/migrations/File_AddHeightAndWidthColumn.js @@ -0,0 +1,34 @@ +module.exports = { + up: (queryInterface, Sequelize) => { + // logic for transforming into the new state + const changeOne = queryInterface.addColumn( + 'File', + 'height', + { + type : Sequelize.INTEGER, + allowNull: false, + } + ); + const changeTwo = queryInterface.addColumn( + 'File', + 'width', + { + type : Sequelize.INTEGER, + allowNull: false, + } + ); + return Promise.all([changeOne, changeTwo]); + }, + down: (queryInterface, Sequelize) => { + // logic for reverting the changes + const reversionOne = queryInterface.removeColumn( + 'File', + 'height' + ); + const reversionTwo = queryInterface.removeColumn( + 'File', + 'width', + ); + return Promise.all([reversionOne, reversionTwo]); + }, +};