UNPKG

@tomei/sso

Version:
96 lines (93 loc) 2.28 kB
'use strict'; /** @type {import('sequelize-cli').Migration} */ module.exports = { up: async (queryInterface, Sequelize) => { await queryInterface.createTable('sso_Building', { GroupCode: { type: Sequelize.STRING(10), primaryKey: true, allowNull: false, references: { model: 'sso_Group', key: 'GroupCode', }, onUpdate: 'CASCADE', onDelete: 'CASCADE', }, BuildingType: { type: Sequelize.ENUM( 'Outlet', 'Office', 'Fulfillment Center', 'Warehouse', ), allowNull: true, }, Email: { type: Sequelize.STRING(200), allowNull: true, }, Mobile: { type: Sequelize.STRING(20), allowNull: true, }, Phone: { type: Sequelize.STRING(20), allowNull: false, }, Brand: { type: Sequelize.STRING(10), allowNull: true, }, OpeningDate: { type: Sequelize.DATE, allowNull: true, }, CeasedDate: { type: Sequelize.DATE, allowNull: true, }, OpeningHours: { type: Sequelize.STRING(200), allowNull: true, }, CreatedById: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'sso_User', key: 'UserId', }, onDelete: 'CASCADE', onUpdate: 'CASCADE', }, CreatedAt: { allowNull: false, defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'), type: Sequelize.DATE, }, UpdatedById: { type: Sequelize.INTEGER, allowNull: true, references: { model: 'sso_User', key: 'UserId', }, onDelete: 'CASCADE', onUpdate: 'CASCADE', }, UpdatedAt: { allowNull: false, defaultValue: Sequelize.literal('CURRENT_TIMESTAMP(3)'), type: Sequelize.DATE, }, }); }, down: async (queryInterface) => { // Drop the trigger before dropping the table await queryInterface.sequelize.query( `DROP TRIGGER IF EXISTS update_GroupCode_ObjectId`, ); await queryInterface.dropTable('sso_Building'); }, };