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





































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