@clickup/pg-microsharding
Version:
Microshards support for PostgreSQL
28 lines (25 loc) • 585 B
text/typescript
import type { TableInfo } from "./getTablesInSchema";
import { subName } from "./names";
import { ident, sql } from "./quote";
import { runSql } from "./runSql";
/**
* Resumes the previously paused subscription.
*/
export async function enableSubscription({
toDsn,
tables,
schema,
}: {
toDsn: string;
tables: TableInfo[];
schema: string;
}): Promise<void> {
if (tables.length === 0) {
return;
}
await runSql(
toDsn,
sql`ALTER SUBSCRIPTION ${ident(subName(schema))} ENABLE`,
"Resuming the destination subscription from the paused position",
);
}