spee.ch/server/migrations/File_AddHeightAndWidthColumn.js

89 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2018-07-25 23:25:40 +02:00
module.exports = {
2018-07-26 02:21:02 +02:00
up: (queryInterface, { INTEGER }) => {
2018-07-25 23:25:40 +02:00
// logic for transforming into the new state
2018-07-26 02:21:02 +02:00
return Promise.all([
queryInterface.addColumn(
'File',
'fileHeight',
{
type : INTEGER,
allowNull: false,
default : 0,
}
),
queryInterface.addColumn(
'File',
'fileWidth',
{
type : INTEGER,
allowNull: false,
default : 0,
}
),
queryInterface.removeColumn(
'File',
'address',
),
queryInterface.removeColumn(
'File',
'height',
),
queryInterface.removeColumn(
'File',
'nsfw',
),
queryInterface.removeColumn(
'File',
'trendingEligible',
),
]);
2018-07-25 23:25:40 +02:00
},
2018-07-26 02:21:02 +02:00
down: (queryInterface, { BOOLEAN, INTEGER, STRING }) => {
return Promise.all([
queryInterface.removeColumn(
'File',
'fileHeight',
),
queryInterface.removeColumn(
'File',
'fileWidth',
),
queryInterface.addColumn(
'File',
'address',
{
type : STRING,
allowNull: false,
}
),
queryInterface.addColumn(
'File',
'height',
{
type : INTEGER,
allowNull: false,
default : 0,
}
),
queryInterface.addColumn(
'File',
'nsfw',
{
type : BOOLEAN,
allowNull : false,
defaultValue: false,
}
),
queryInterface.addColumn(
'File',
'trendingEligible',
{
type : BOOLEAN,
allowNull : false,
defaultValue: true,
}
),
]);
2018-07-25 23:25:40 +02:00
},
};