summaryrefslogblamecommitdiffstats
path: root/server/migrations/20180717202333-create-group_x_group.js
blob: 298c2fba4bb5e2bc3ad70a6d829a13f83ec6ad3c (plain) (tree)
1
2
3
4
5
6
7
8
9







                                                        
                            








                                
                            










                                                    
'use strict'
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('group_x_group', {
      parentId: {
        primaryKey: true,
        allowNull: false,
        type: Sequelize.INTEGER,
        onDelete: 'cascade',
        references: {
          model: 'groups',
          key: 'id'
        }
      },
      childId: {
        primaryKey: true,
        allowNull: false,
        type: Sequelize.INTEGER,
        onDelete: 'cascade',
        references: {
          model: 'groups',
          key: 'id'
        }
      }
    })
  },
  down: (queryInterface, Sequelize) => {
    return queryInterface.dropTable('group_x_group')
  }
}