summaryrefslogblamecommitdiffstats
path: root/server/migrations/20180726173100-create-role_x_permission.js
blob: edfcb8ed146df5a7fe06610df4007730ebc1165c (plain) (tree)





























                                                            
'use strict'
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('role_x_permission', {
      roleId: {
        primaryKey: true,
        allowNull: false,
        type: Sequelize.INTEGER,
        onDelete: "cascade",
        references: {
          model: 'roles',
          key: 'id'
        }
      },
      permissionId: {
        primaryKey: true,
        allowNull: false,
        type: Sequelize.INTEGER,
        onDelete: "cascade",
        references: {
          model: 'permissions',
          key: 'id'
        }
      }
    })
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('role_x_permission')
  }
}