diff --git a/src/postgraphql/watch/__tests__/watchPgSchemas-test.js b/src/postgraphql/watch/__tests__/watchPgSchemas-test.js index 461d939196..1beac2d639 100644 --- a/src/postgraphql/watch/__tests__/watchPgSchemas-test.js +++ b/src/postgraphql/watch/__tests__/watchPgSchemas-test.js @@ -33,7 +33,11 @@ test('will log some stuff and continue if the watch fixtures query fails', async await watchPgSchemas({ pgPool }) console.warn = origWarn expect(pgPool.connect.mock.calls).toEqual([[]]) - expect(pgClient.query.mock.calls).toEqual([[await _watchFixturesQuery], ['listen postgraphql_watch']]) + expect(pgClient.query.mock.calls).toEqual([ + [await _watchFixturesQuery], + ['rollback'], + ['listen postgraphql_watch'], + ]) expect(pgClient.on.mock.calls.length).toBe(1) expect(pgClient.on.mock.calls[0].length).toBe(2) expect(pgClient.on.mock.calls[0][0]).toBe('notification') diff --git a/src/postgraphql/watch/watchPgSchemas.ts b/src/postgraphql/watch/watchPgSchemas.ts index 44f1e31a6f..d84e0dcf18 100644 --- a/src/postgraphql/watch/watchPgSchemas.ts +++ b/src/postgraphql/watch/watchPgSchemas.ts @@ -45,6 +45,7 @@ export default async function watchPgSchemas ({ pgPool, pgSchemas, onChange }: { console.warn(chalk.yellow('This is likely because your Postgres user is not a superuser. If the')) console.warn(chalk.yellow('fixtures already exist, the watch functionality may still work.')) // tslint:enable no-console + await pgClient.query('rollback') } // Listen to the `postgraphql_watch` channel. Any and all updates will come