screwdriver-data-schema
Version:
Internal Data Schema of Screwdriver
37 lines (33 loc) • 1.03 kB
JavaScript
/* eslint-disable new-cap */
;
const prefix = process.env.DATASTORE_SEQUELIZE_PREFIX || '';
const table = `${prefix}banners`;
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn(
table,
'scope',
{
type: Sequelize.STRING(15),
defaultValue: 'GLOBAL',
allowNull: false
},
{ transaction }
);
await queryInterface.addColumn(
table,
'scopeId',
{
type: Sequelize.INTEGER.UNSIGNED
},
{ transaction }
);
await queryInterface.addIndex(table, {
name: `${table}_scope_and_scopeId`,
fields: ['scope', 'scopeId'],
transaction
});
});
}
};