narinder1231 commited on
Commit
b69e441
·
1 Parent(s): 785f3a2

add migrations for role permission table

Browse files
src/db/migrations/20240711130904-create-role-permissions.js CHANGED
@@ -2,7 +2,7 @@
2
  /** @type {import('sequelize-cli').Migration} */
3
  module.exports = {
4
  async up(queryInterface, Sequelize) {
5
- await queryInterface.createTable('Role_Permission', {
6
  id: {
7
  allowNull: false,
8
  autoIncrement: true,
@@ -13,7 +13,7 @@ module.exports = {
13
  allowNull: false,
14
  type: Sequelize.INTEGER,
15
  references: {
16
- model: 'Roles',
17
  key: 'id'
18
  },
19
  onDelete: 'CASCADE'
@@ -22,22 +22,22 @@ module.exports = {
22
  allowNull: false,
23
  type: Sequelize.INTEGER,
24
  references: {
25
- model: 'Permissions',
26
  key: 'id'
27
  },
28
  onDelete: 'CASCADE'
29
  },
30
- createdAt: {
31
  allowNull: false,
32
  type: Sequelize.DATE
33
  },
34
- updatedAt: {
35
  allowNull: false,
36
  type: Sequelize.DATE
37
  }
38
  });
39
  },
40
  async down(queryInterface, Sequelize) {
41
- await queryInterface.dropTable('Role_Permission');
42
  }
43
  };
 
2
  /** @type {import('sequelize-cli').Migration} */
3
  module.exports = {
4
  async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('role_permission', {
6
  id: {
7
  allowNull: false,
8
  autoIncrement: true,
 
13
  allowNull: false,
14
  type: Sequelize.INTEGER,
15
  references: {
16
+ model: 'roles',
17
  key: 'id'
18
  },
19
  onDelete: 'CASCADE'
 
22
  allowNull: false,
23
  type: Sequelize.INTEGER,
24
  references: {
25
+ model: 'permissions',
26
  key: 'id'
27
  },
28
  onDelete: 'CASCADE'
29
  },
30
+ created_at: {
31
  allowNull: false,
32
  type: Sequelize.DATE
33
  },
34
+ updated_at: {
35
  allowNull: false,
36
  type: Sequelize.DATE
37
  }
38
  });
39
  },
40
  async down(queryInterface, Sequelize) {
41
+ await queryInterface.dropTable('role_permission');
42
  }
43
  };