diff --git a/src/commands/base.ts b/src/commands/base.ts index 54046f1..c90c04e 100644 --- a/src/commands/base.ts +++ b/src/commands/base.ts @@ -11,10 +11,6 @@ export abstract class BaseCommand extends Command { required: false, }); - dryRun = Option.Boolean("--dry-run", false, { - description: "Print statements without executing", - }); - protected getDatabaseUrl(): string { const url = this.url ?? process.env.PGSLICE_URL; if (!url) { @@ -27,9 +23,6 @@ export abstract class BaseCommand extends Command { try { this.context.pgslice ??= await Pgslice.connect( new URL(this.getDatabaseUrl()), - { - dryRun: this.dryRun, - }, ); await this.perform(this.context.pgslice); diff --git a/src/commands/synchronize.ts b/src/commands/synchronize.ts index f03bc8b..819a8de 100644 --- a/src/commands/synchronize.ts +++ b/src/commands/synchronize.ts @@ -39,6 +39,10 @@ export class SynchronizeCommand extends BaseCommand { ], }); + dryRun = Option.Boolean("--dry-run", false, { + description: "Print statements without executing", + }); + table = Option.String({ required: true, name: "table" }); start = Option.String("--start", { diff --git a/src/pgslice.ts b/src/pgslice.ts index d019c5b..7201102 100644 --- a/src/pgslice.ts +++ b/src/pgslice.ts @@ -35,8 +35,6 @@ import { Swapper } from "./swapper.js"; import { AdvisoryLock } from "./advisory-lock.js"; interface PgsliceOptions { - dryRun?: boolean; - /** * Whether to use Postgres advisory locks to prevent concurrent operations * on the same table for the same operation. Defaults to true. @@ -46,11 +44,9 @@ interface PgsliceOptions { export class Pgslice { #pool: DatabasePool | null = null; - #dryRun: boolean; #advisoryLocks: boolean; constructor(pool: DatabasePool, options: PgsliceOptions) { - this.#dryRun = options.dryRun ?? false; this.#advisoryLocks = options.advisoryLocks ?? true; this.#pool = pool; } @@ -88,10 +84,6 @@ export class Pgslice { async start( handler: (transaction: DatabasePoolConnection) => Promise, ): Promise { - if (this.#dryRun) { - throw new Error("Dry run not yet supported."); - } - return this.pool.connect(handler); }