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

@@ -24,7 +24,7 @@ import { issueJWT } from '../../../src/UserManagement/auth/jwt';
import { getLogger } from '../../../src/Logger';
import { credentialsController } from '../../../src/api/credentials.api';
import type { User } from '../../../src/databases/entities/User';
import type { EndpointGroup, SmtpTestAccount } from './types';
import type { EndpointGroup, PostgresSchemaSection, SmtpTestAccount } from './types';
import type { N8nApp } from '../../../src/UserManagement/Interfaces';
import * as UserManagementMailer from '../../../src/UserManagement/email/UserManagementMailer';
@@ -262,3 +262,15 @@ export const categorize = <T>(arr: T[], test: (str: T) => boolean) => {
{ pass: [], fail: [] },
);
};
export function getPostgresSchemaSection(
schema = config.getSchema(),
): PostgresSchemaSection | null {
for (const [key, value] of Object.entries(schema)) {
if (key === 'postgresdb') {
return value._cvtProperties;
}
}
return null;
}