20210609183220-port.js 1020 Bytes
'use strict';
module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.createTable('Ports', {
      id: {
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      ContainerId: {
        allowNull: false,
        type: Sequelize.INTEGER,
        onDelete: 'CASCADE',
        references: {
          model: 'Containers',
          key: 'id'
        }
      },
      innerPort: {
        allowNull: false,
        type: Sequelize.INTEGER
      },
      outerPort: {
        allowNull: false,
        type: Sequelize.INTEGER
      },
      description: {
        type: Sequelize.TEXT('long')
      },
      createdAt: {
        allowNull: false,
        type: Sequelize.DATE
      },
      updatedAt: {
        allowNull: false,
        type: Sequelize.DATE
      }
    },{
      charset: 'utf8mb4',
      collate: 'utf8mb4_unicode_ci'
    })
  },
  down: async (queryInterface, Sequelize) => {
    await queryInterface.dropTable('Ports');
  }
};