UNPKG

@clickup/pg-mig

Version:

PostgreSQL schema migration tool with microsharding and clustering support

19 lines (17 loc) 582 B
/** * Returns true if the schema should have migrations applied. Non-shard schemas * (matched by the exact prefix name, e.g. "public") are always valid. Shard * schemas (matched by prefix + digits, e.g. "sh0042") are valid only when * validShards is undefined (no filter) or contains the schema name. */ export function isSchemaValid( schema: string, schemaPrefix: string, validShards: Set<string> | undefined, ): boolean { if (!validShards) { return true; } const isShardSchema = schema !== schemaPrefix; return !isShardSchema || validShards.has(schema); }