Compare commits

..

No commits in common. "2e9108d8ecf7e6c3405b9ffe57cf10f1326b0237" and "f3cdf7b89a5779e5b4d2928067509f4e46989a69" have entirely different histories.

2 changed files with 5 additions and 14 deletions

View File

@ -1,16 +1,5 @@
module.exports = {
async up(queryInterface, Sequelize) {
// Ensure the table exists before trying to insert
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")
);
`);
await queryInterface.sequelize.query(`
INSERT INTO "rolesPermissionsPermissions" ("createdAt", "updatedAt", "roles_permissionsId", "permissionId")
SELECT NOW(), NOW(), r.id, p.id
@ -27,4 +16,4 @@ module.exports = {
AND "permissionId" IN (SELECT id FROM permissions WHERE name IN ('READ_COURSES', 'READ_USERS', 'READ_CATEGORIES', 'READ_LESSONS'));
`);
}
};
};

View File

@ -1,3 +1,4 @@
const { v4: uuid } = require("uuid");
module.exports = {
@ -67,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 IF NOT EXISTS "rolesPermissionsPermissions"
await queryInterface.sequelize.query(`create table "rolesPermissionsPermissions"
(
"createdAt" timestamp with time zone not null,
"updatedAt" timestamp with time zone not null,
@ -879,4 +880,5 @@ await queryInterface.bulkInsert("rolesPermissionsPermissions", [
}
};
};