refactor(core): Add support for implicit schema in postgres migrations (#5233)
This commit is contained in:
committed by
GitHub
parent
726b573eab
commit
a86c9a628b
@@ -1,6 +1,5 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
import config from '@/config';
|
||||
import { runInBatches } from '@db/utils/migrationHelpers';
|
||||
import { getTablePrefix, runInBatches } from '@db/utils/migrationHelpers';
|
||||
|
||||
// replacing the credentials in workflows and execution
|
||||
// `nodeType: name` changes to `nodeType: { id, name }`
|
||||
@@ -9,13 +8,7 @@ export class UpdateWorkflowCredentials1630419189837 implements MigrationInterfac
|
||||
name = 'UpdateWorkflowCredentials1630419189837';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
let tablePrefix = config.getEnv('database.tablePrefix');
|
||||
const schema = config.getEnv('database.postgresdb.schema');
|
||||
if (schema) {
|
||||
tablePrefix = schema + '.' + tablePrefix;
|
||||
}
|
||||
|
||||
await queryRunner.query(`SET search_path TO ${schema};`);
|
||||
const tablePrefix = getTablePrefix();
|
||||
|
||||
const credentialsEntities = await queryRunner.query(`
|
||||
SELECT id, name, type
|
||||
@@ -154,12 +147,7 @@ export class UpdateWorkflowCredentials1630419189837 implements MigrationInterfac
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
let tablePrefix = config.getEnv('database.tablePrefix');
|
||||
const schema = config.getEnv('database.postgresdb.schema');
|
||||
if (schema) {
|
||||
tablePrefix = schema + '.' + tablePrefix;
|
||||
}
|
||||
await queryRunner.query(`SET search_path TO ${schema};`);
|
||||
const tablePrefix = getTablePrefix();
|
||||
|
||||
const credentialsEntities = await queryRunner.query(`
|
||||
SELECT id, name, type
|
||||
|
||||
Reference in New Issue
Block a user