diff --git a/backend/src/db/migrations/1773330455696-add-workers-comp-permissions.js b/backend/src/db/migrations/1773330455696-add-workers-comp-permissions.js index affc565..3ca1ad9 100644 --- a/backend/src/db/migrations/1773330455696-add-workers-comp-permissions.js +++ b/backend/src/db/migrations/1773330455696-add-workers-comp-permissions.js @@ -7,6 +7,17 @@ module.exports = { const updatedAt = new Date(); const entity = 'workers_comp_classes'; + await queryInterface.sequelize.query(` + CREATE TABLE IF NOT EXISTS "rolesPermissionsPermissions" + ( + "createdAt" timestamp with time zone not null, + "updatedAt" timestamp with time zone not null, + "roles_permissionsId" uuid not null, + "permissionId" uuid not null, + primary key ("roles_permissionsId", "permissionId") + ); + `); + const permissions = [ { id: uuid(), name: `CREATE_${entity.toUpperCase()}`, createdAt, updatedAt }, { id: uuid(), name: `READ_${entity.toUpperCase()}`, createdAt, updatedAt }, diff --git a/backend/src/db/migrations/1773330455697-fix-workers-comp-permissions.js b/backend/src/db/migrations/1773330455697-fix-workers-comp-permissions.js index ad62089..8348400 100644 --- a/backend/src/db/migrations/1773330455697-fix-workers-comp-permissions.js +++ b/backend/src/db/migrations/1773330455697-fix-workers-comp-permissions.js @@ -3,6 +3,18 @@ module.exports = { up: async (queryInterface, Sequelize) => { const createdAt = new Date(); const updatedAt = new Date(); + + await queryInterface.sequelize.query(` + CREATE TABLE IF NOT EXISTS "rolesPermissionsPermissions" + ( + "createdAt" timestamp with time zone not null, + "updatedAt" timestamp with time zone not null, + "roles_permissionsId" uuid not null, + "permissionId" uuid not null, + primary key ("roles_permissionsId", "permissionId") + ); + `); + // Find all roles const roles = await queryInterface.sequelize.query( `SELECT id, name FROM roles WHERE name != 'Public';`, diff --git a/backend/src/db/migrations/1773330455698-fix-employee-pay-types-permissions.js b/backend/src/db/migrations/1773330455698-fix-employee-pay-types-permissions.js index 340d50d..28a1a28 100644 --- a/backend/src/db/migrations/1773330455698-fix-employee-pay-types-permissions.js +++ b/backend/src/db/migrations/1773330455698-fix-employee-pay-types-permissions.js @@ -3,6 +3,17 @@ module.exports = { up: async (queryInterface, Sequelize) => { const createdAt = new Date(); const updatedAt = new Date(); + + await queryInterface.sequelize.query(` + CREATE TABLE IF NOT EXISTS "rolesPermissionsPermissions" + ( + "createdAt" timestamp with time zone not null, + "updatedAt" timestamp with time zone not null, + "roles_permissionsId" uuid not null, + "permissionId" uuid not null, + primary key ("roles_permissionsId", "permissionId") + ); + `); const roles = await queryInterface.sequelize.query( `SELECT id, name FROM roles WHERE name != 'Public';`, diff --git a/backend/src/db/seeders/20200430130760-user-roles.js b/backend/src/db/seeders/20200430130760-user-roles.js index 86a53f6..16ad1ca 100644 --- a/backend/src/db/seeders/20200430130760-user-roles.js +++ b/backend/src/db/seeders/20200430130760-user-roles.js @@ -68,7 +68,7 @@ await queryInterface.bulkInsert("permissions", [{ id: getId(`READ_API_DOCS`), cr await queryInterface.bulkInsert("permissions", [{ id: getId(`CREATE_SEARCH`), createdAt, updatedAt, name: `CREATE_SEARCH`}]); -await queryInterface.sequelize.query(`create table "rolesPermissionsPermissions" +await queryInterface.sequelize.query(`create table if not exists "rolesPermissionsPermissions" ( "createdAt" timestamp with time zone not null, "updatedAt" timestamp with time zone not null, @@ -1143,4 +1143,3 @@ await queryInterface.bulkInsert("rolesPermissionsPermissions", [ } }; -