fix(core): Fix migrations on non-public Postgres schema (#3356)

* 🐛 Fix UM migration

*  Account for schema in `search_path`

* 🔥 Remove unneeded schema refs

* 🧪 Account for alt schema in DB testing

*  Add schema to `IncreaseTypeVarcharLimit`

*  Set `search_path` in every migration

*  Set `search_path` in down migrations
This commit is contained in:
Iván Ovejero
2022-05-30 11:33:17 +02:00
committed by GitHub
parent 56c07a45d5
commit b49d493653
18 changed files with 124 additions and 25 deletions

View File

@@ -12,6 +12,8 @@ export class AddWebhookId1611144599516 implements MigrationInterface {
tablePrefix = schema + '.' + tablePrefix;
}
await queryRunner.query(`SET search_path TO ${schema};`);
await queryRunner.query(`ALTER TABLE ${tablePrefix}webhook_entity ADD "webhookId" character varying`);
await queryRunner.query(`ALTER TABLE ${tablePrefix}webhook_entity ADD "pathLength" integer`);
await queryRunner.query(`CREATE INDEX IF NOT EXISTS IDX_${tablePrefixPure}16f4436789e804e3e1c9eeb240 ON ${tablePrefix}webhook_entity ("webhookId", "method", "pathLength") `);
@@ -24,6 +26,7 @@ export class AddWebhookId1611144599516 implements MigrationInterface {
if (schema) {
tablePrefix = schema + '.' + tablePrefix;
}
await queryRunner.query(`SET search_path TO ${schema};`);
await queryRunner.query(`DROP INDEX IDX_${tablePrefixPure}16f4436789e804e3e1c9eeb240`);
await queryRunner.query(`ALTER TABLE ${tablePrefix}webhook_entity DROP COLUMN "pathLength"`);