@clickup/pg-microsharding
Version:
Microshards support for PostgreSQL
22 lines (20 loc) • 455 B
text/typescript
import { shardFactorToComment } from "../internal/names";
import { ident, sql } from "../internal/quote";
import { runSql } from "../internal/runSql";
/**
* Sets the weight factor for some shard schema.
*/
export async function factor({
dsn,
schema,
factor,
}: {
dsn: string;
schema: string;
factor: number;
}): Promise<void> {
await runSql(
dsn,
sql`COMMENT ON SCHEMA ${ident(schema)} IS ${shardFactorToComment(factor)}`,
);
}