diff --git a/packages/migrator/src/migrator.ts b/packages/migrator/src/migrator.ts index 09fb585c..5e568270 100644 --- a/packages/migrator/src/migrator.ts +++ b/packages/migrator/src/migrator.ts @@ -728,7 +728,11 @@ export class Migrator { */ async useShadowClient(cb: (client: Client) => Promise) { const shadowDbName = `shadow_${Date.now()}_${randomInt(1_000_000)}` - const shadowConnectionString = this.client.connectionString().replace(/\w+$/, shadowDbName) + + const shadowConnectionUrl = new URL(this.client.connectionString()); + shadowConnectionUrl.pathname = shadowDbName; + const shadowConnectionString = shadowConnectionUrl.toString(); + const shadowClient = createClient(shadowConnectionString, this.client.options) try {