summaryrefslogblamecommitdiffstats
path: root/server/migrations/20180805054700-create-backend_x_group.js
blob: d187e2403ea3f240b30d9da1186732721d0d66c3 (plain) (tree)





































                                                          
'use strict'
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('backend_x_group', {
      backendId: {
        primaryKey: true,
        allowNull: false,
        type: Sequelize.INTEGER,
        onDelete: 'cascade',
        references: {
          model: 'backends',
          key: 'id'
        }
      },
      groupId: {
        allowNull: true,
        type: Sequelize.INTEGER,
        onDelete: 'SET NULL',
        references: {
          model: 'groups',
          key: 'id'
        }
      },
      externalId: {
        primaryKey: true,
        allowNull: true,
        type: Sequelize.INTEGER
      },
      externalType: {
        allowNull: true,
        type: Sequelize.STRING
      }
    })
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('backend_x_group')
  }
}