summaryrefslogblamecommitdiffstats
path: root/server/migrations/20180726173100-create-role_x_permission.js
blob: 4136ef444c57c8702c78fe38bc0bc8a394f95cff (plain) (tree)
1
2
3
4
5
6
7
8
9







                                                            
                            








                                
                            









                                                        
 
'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')
  }
}