From 15a73fdaf0ef11acc8da3759c09a928b8961dd5f Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Thu, 4 Jan 2024 13:18:17 -0500 Subject: [PATCH] (core) repair a migration test when running against postgres Summary: This is fixing some fall-out from some environmental changes after another batch of tests were moved to grist-core. Test Plan: this is fixing a test, no app changes Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4156 --- test/gen-server/migrations.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/gen-server/migrations.ts b/test/gen-server/migrations.ts index 5844e03a..166e5d79 100644 --- a/test/gen-server/migrations.ts +++ b/test/gen-server/migrations.ts @@ -79,6 +79,13 @@ describe('migrations', function() { beforeEach(async function() { await home.connect(); + // If testing against postgres, remove all tables. + // If SQLite, we're using a fresh in-memory db each time. + const sqlite = home.connection.driver.options.type === 'sqlite'; + if (!sqlite) { + await home.connection.query('DROP SCHEMA public CASCADE'); + await home.connection.query('CREATE SCHEMA public'); + } await createInitialDb(home.connection, false); });