diff --git a/__tests__/__snapshots__/settings.test.ts.snap b/__tests__/__snapshots__/settings.test.ts.snap index 0e33092..68d7da5 100644 --- a/__tests__/__snapshots__/settings.test.ts.snap +++ b/__tests__/__snapshots__/settings.test.ts.snap @@ -38,7 +38,7 @@ exports[`actions is backwards-compatible with untagged command specs 1`] = ` "manageGraphileMigrateSchema": true, "migrationsFolder": "./migrations", "placeholders": undefined, - "rootConnectionString": "template1", + "rootConnectionString": "postgres:///template1", "shadowConnectionString": undefined, "shadowDatabaseName": undefined, } @@ -79,7 +79,7 @@ exports[`actions parses SQL actions 1`] = ` "manageGraphileMigrateSchema": true, "migrationsFolder": "./migrations", "placeholders": undefined, - "rootConnectionString": "template1", + "rootConnectionString": "postgres:///template1", "shadowConnectionString": undefined, "shadowDatabaseName": undefined, } @@ -115,7 +115,7 @@ exports[`actions parses command actions 1`] = ` "manageGraphileMigrateSchema": true, "migrationsFolder": "./migrations", "placeholders": undefined, - "rootConnectionString": "template1", + "rootConnectionString": "postgres:///template1", "shadowConnectionString": undefined, "shadowDatabaseName": undefined, } @@ -159,7 +159,7 @@ exports[`actions parses mixed actions 1`] = ` "manageGraphileMigrateSchema": true, "migrationsFolder": "./migrations", "placeholders": undefined, - "rootConnectionString": "template1", + "rootConnectionString": "postgres:///template1", "shadowConnectionString": undefined, "shadowDatabaseName": undefined, } @@ -200,7 +200,7 @@ exports[`actions parses string values into SQL actions 1`] = ` "manageGraphileMigrateSchema": true, "migrationsFolder": "./migrations", "placeholders": undefined, - "rootConnectionString": "template1", + "rootConnectionString": "postgres:///template1", "shadowConnectionString": undefined, "shadowDatabaseName": undefined, } diff --git a/__tests__/actions.test.ts b/__tests__/actions.test.ts index 110f131..86a2297 100644 --- a/__tests__/actions.test.ts +++ b/__tests__/actions.test.ts @@ -93,7 +93,9 @@ it("runs sql afterReset action with correct connection string when root", async mockedWithClient.mockClear(); await executeActions(parsedSettings, false, parsedSettings.afterReset); expect(mockedWithClient).toHaveBeenCalledTimes(1); - expect(mockedWithClient.mock.calls[0][0]).toBe(TEST_DATABASE_NAME); + expect(mockedWithClient.mock.calls[0][0]).toBe( + `postgres:///${TEST_DATABASE_NAME}`, + ); }); it("runs command afterReset action with correct env vars when root", async () => { diff --git a/src/settings.ts b/src/settings.ts index 97ae7c0..79e665e 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -157,7 +157,8 @@ export async function parseSettings( const rootConnectionString = await check( "rootConnectionString", ( - rawRootConnectionString = process.env.ROOT_DATABASE_URL || "template1", + rawRootConnectionString = process.env.ROOT_DATABASE_URL || + "postgres:///template1", ): string => { if (typeof rawRootConnectionString !== "string") { throw new Error(