fix: postgres migration missing schema name (#4164)
This commit is contained in:
@@ -5,7 +5,11 @@ export class CreateCredentialsUserRole1660062385367 implements MigrationInterfac
|
|||||||
name = 'CreateCredentialsUserRole1660062385367';
|
name = 'CreateCredentialsUserRole1660062385367';
|
||||||
|
|
||||||
async up(queryRunner: QueryRunner): Promise<void> {
|
async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
let tablePrefix = config.getEnv('database.tablePrefix');
|
||||||
|
const schema = config.getEnv('database.postgresdb.schema');
|
||||||
|
if (schema) {
|
||||||
|
tablePrefix = schema + '.' + tablePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
await queryRunner.query(`
|
await queryRunner.query(`
|
||||||
INSERT INTO ${tablePrefix}role (name, scope)
|
INSERT INTO ${tablePrefix}role (name, scope)
|
||||||
@@ -15,7 +19,11 @@ export class CreateCredentialsUserRole1660062385367 implements MigrationInterfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
async down(queryRunner: QueryRunner): Promise<void> {
|
async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
let tablePrefix = config.getEnv('database.tablePrefix');
|
||||||
|
const schema = config.getEnv('database.postgresdb.schema');
|
||||||
|
if (schema) {
|
||||||
|
tablePrefix = schema + '.' + tablePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
await queryRunner.query(`
|
await queryRunner.query(`
|
||||||
DELETE FROM ${tablePrefix}role WHERE name='user' AND scope='credential';
|
DELETE FROM ${tablePrefix}role WHERE name='user' AND scope='credential';
|
||||||
|
|||||||
Reference in New Issue
Block a user