Forced merge: merge ai-dev into master
This commit is contained in:
commit
2e9108d8ec
@ -1,5 +1,16 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
async up(queryInterface, Sequelize) {
|
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(`
|
await queryInterface.sequelize.query(`
|
||||||
INSERT INTO "rolesPermissionsPermissions" ("createdAt", "updatedAt", "roles_permissionsId", "permissionId")
|
INSERT INTO "rolesPermissionsPermissions" ("createdAt", "updatedAt", "roles_permissionsId", "permissionId")
|
||||||
SELECT NOW(), NOW(), r.id, p.id
|
SELECT NOW(), NOW(), r.id, p.id
|
||||||
@ -16,4 +27,4 @@ module.exports = {
|
|||||||
AND "permissionId" IN (SELECT id FROM permissions WHERE name IN ('READ_COURSES', 'READ_USERS', 'READ_CATEGORIES', 'READ_LESSONS'));
|
AND "permissionId" IN (SELECT id FROM permissions WHERE name IN ('READ_COURSES', 'READ_USERS', 'READ_CATEGORIES', 'READ_LESSONS'));
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
const { v4: uuid } = require("uuid");
|
const { v4: uuid } = require("uuid");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -68,7 +67,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.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,
|
"createdAt" timestamp with time zone not null,
|
||||||
"updatedAt" timestamp with time zone not null,
|
"updatedAt" timestamp with time zone not null,
|
||||||
@ -880,5 +879,4 @@ await queryInterface.bulkInsert("rolesPermissionsPermissions", [
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user