summaryrefslogblamecommitdiffstats
path: root/server/migrations/20180726033400-create-user_x_role.js
blob: cbf573501df49273ec74fb6e096a50f926e03fc1 (plain) (tree)
1
2
3
4
5
6
7
8
9







                                                      
                            








                                
                            









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