@clickup/pg-mig
Version:
PostgreSQL schema migration tool with microsharding and clustering support
19 lines • 780 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.schemaNameMatchesPrefix = schemaNameMatchesPrefix;
/**
* See unit test for matching and non-matching examples.
*/
function schemaNameMatchesPrefix(schema, prefix) {
const schemaStartsWithPrefix = schema.startsWith(prefix);
const schemaEqualsToPrefixExactly = schema === prefix;
const schemaHasDigitAfterPrefix = schema
.substring(prefix.length)
.match(/^\d/);
const prefixItselfHasDigitSoItIsSelectiveEnough = prefix.match(/\d/);
return !!(schemaStartsWithPrefix &&
(schemaEqualsToPrefixExactly ||
schemaHasDigitAfterPrefix ||
prefixItselfHasDigitSoItIsSelectiveEnough));
}
//# sourceMappingURL=schemaNameMatchesPrefix.js.map