import { Pool } from 'pg'; import { DbLogger } from '../common'; import { LogicalReplicationOperation } from './create-logical-replication-service'; /** * A set of parameters used by `ensureReplicationSlotAndPublicationExist` helper. */ export interface EnsureReplicationSlotAndPublicationExistParams { /** * The name of the replication slot associated with the current database to be * checked for existence and (re)created. * * The name must be a unique value across all databases present in the * PostgreSQL Server. */ replicationSlotName: string; /** * The name of the publication associated with the current database to be * checked for existence and (re)created. */ publicationName: string; /** * List of table names to be associated with publication to observe changes on. * `REPLICA IDENTITY FULL` is set for each passed table. */ tableNames: string[]; /** * Name of the schema for passed publication tables. */ schemaName: string; /** * PostgreSQL Pool instance. The role that is used to create this instance * must have a `REPLICATION` attribute assigned to it. */ replicationPgPool: Pool; /** * An array of database operations to be associated with (re)created * publication that will be observed. * @default - `insert`, `update`, `delete` */ operationsToWatch?: LogicalReplicationOperation[]; /** * Logical Replication output plugin to be used during (re)creation of the * replication slot. * @default - `pgoutput` */ pluginName?: string; /** * Mosaic logger instance to log info messages. If not provided, `console.log` * is used instead. */ logger?: DbLogger; } /** * Checks if specified replication slot and publication exist. If at least one * does not exists, or tables have changed - idempotently (re)creates both. * * It is preferable to run this helper on startup instead of defining the * replication slot and publication in context of migrations, because in cases * of database failover, the replication slots are not transferred between * primary and secondary databases, so the service needs to ensure that slot and * publication exist on its own. */ export declare const ensureReplicationSlotAndPublicationExist: ({ replicationSlotName, publicationName, replicationPgPool, tableNames, schemaName, operationsToWatch, pluginName, logger, }: EnsureReplicationSlotAndPublicationExistParams) => Promise; //# sourceMappingURL=ensure-replication-slot-and-publication-exist.d.ts.map