summaryrefslogblamecommitdiffstats
path: root/server/migrations/20180805054700-create-backend_x_group.js
blob: 26c2c42c68574f2b5f1a426ed16e1e8bfbd23b20 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                          
                         
                                
                            






                          
                         











                                                      
'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: false,
        type: Sequelize.INTEGER,
        onDelete: 'cascade',
        references: {
          model: 'groups',
          key: 'id'
        }
      },
      externalId: {
        primaryKey: true,
        allowNull: false,
        type: Sequelize.INTEGER
      },
      externalType: {
        allowNull: true,
        type: Sequelize.STRING
      }
    })
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('backend_x_group')
  }
}