From b3af00c7b9822509a8323ca79ee26dbd098ed3a1 Mon Sep 17 00:00:00 2001 From: Alan Cruikshanks Date: Sun, 21 Jan 2024 22:11:00 +0000 Subject: [PATCH] Fix licence agreement tear down again! (#675) https://eaflood.atlassian.net/browse/WATER-4336 Ok, we've made a bit of a hash with trying to [improve the tear-down speed](https://github.com/DEFRA/water-abstraction-system/pull/671). We realised in the rewrite we'd dropped a licence agreement DELETE statement that needed including so [fixed it](https://github.com/DEFRA/water-abstraction-system/pull/673/files). Then we realised the tear-down was now faster but more flaky so [switched to the single query strategy](https://github.com/DEFRA/water-abstraction-system/pull/674). Only in the switch what do you know, we lost the licence agreement DELETE statement again. Hopefully, for the last time, we fix this! --- app/services/data/tear-down/water-schema.service.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/services/data/tear-down/water-schema.service.js b/app/services/data/tear-down/water-schema.service.js index 0eedf402ac..7bfdabdf9a 100644 --- a/app/services/data/tear-down/water-schema.service.js +++ b/app/services/data/tear-down/water-schema.service.js @@ -170,6 +170,14 @@ async function _deleteAllTestData () { WHERE "is_test" = TRUE; + DELETE + FROM + "water"."licence_agreements" AS "la" + USING "water"."licences" AS "l" + WHERE + "l"."is_test" = TRUE + AND "la"."licence_ref" = "l"."licence_ref"; + DELETE FROM "water"."financial_agreement_types"