seperate ensureSchemaExists config

Signed-off-by: Chap Ambrose <cambrose@salesforce.com>
This commit is contained in:
Chap Ambrose
2024-04-30 16:52:20 -05:00
parent 6e14fefe53
commit 12a5feff7a
@@ -321,7 +321,7 @@ export class PgConnector implements Connector {
let schemaOverrides;
if (this.getPluginDivisionModeConfig() === 'schema') {
schemaOverrides = this.getSchemaOverrides(pluginId);
if (this.getEnsureExistsConfig(pluginId)) {
if (this.getEnsureSchemaExistsConfig(pluginId)) {
try {
await pgConnector.ensureSchemaExists!(pluginConfig, pluginId);
} catch (error) {
@@ -437,6 +437,15 @@ export class PgConnector implements Connector {
);
}
private getEnsureSchemaExistsConfig(pluginId: string): boolean {
const baseConfig =
this.config.getOptionalBoolean('ensureSchemaExists') ?? true;
return (
this.config.getOptionalBoolean(`${pluginPath(pluginId)}.ensureExists`) ??
baseConfig
);
}
private getPluginDivisionModeConfig(): string {
return this.config.getOptionalString('pluginDivisionMode') ?? 'database';
}