Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missed table to tear-down function #749

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/services/data/tear-down/water-schema.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function _deleteAllTestData () {
ALTER TABLE water.billing_transactions DISABLE TRIGGER ALL;
ALTER TABLE water.billing_volumes DISABLE TRIGGER ALL;
ALTER TABLE water.charge_elements DISABLE TRIGGER ALL;
ALTER TABLE water.charge_purposes DISABLE TRIGGER ALL;
ALTER TABLE water.charge_versions DISABLE TRIGGER ALL;
ALTER TABLE water.charge_version_workflows DISABLE TRIGGER ALL;
ALTER TABLE water.licence_agreements DISABLE TRIGGER ALL;
Expand Down Expand Up @@ -116,6 +117,18 @@ async function _deleteAllTestData () {
FROM
"water"."charge_version_workflows";

DELETE
FROM
"water"."charge_purposes" AS "cp"
USING "water"."charge_elements" AS "ce",
"water"."charge_versions" AS "cv",
"water"."licences" AS "l"
WHERE
"l"."is_test" = TRUE
AND "cp"."charge_element_id" = "ce"."charge_element_id"
AND "ce"."charge_version_id" = "cv"."charge_version_id"
AND "cv"."licence_id" = "l"."licence_id";

DELETE
FROM
"water"."charge_elements" AS "ce"
Expand All @@ -134,6 +147,22 @@ async function _deleteAllTestData () {
"l"."is_test" = TRUE
AND "cv"."licence_id" = "l"."licence_id";

DELETE
FROM
"water"."charge_purposes"
WHERE
"is_test" = TRUE;
DELETE
FROM
"water"."charge_elements"
WHERE
"is_test" = TRUE;
DELETE
FROM
"water"."charge_versions"
WHERE
"is_test" = TRUE;

DELETE
FROM
"water"."return_requirement_purposes" AS "rrp"
Expand Down Expand Up @@ -259,6 +288,7 @@ async function _deleteAllTestData () {
ALTER TABLE water.billing_transactions ENABLE TRIGGER ALL;
ALTER TABLE water.billing_volumes ENABLE TRIGGER ALL;
ALTER TABLE water.charge_elements ENABLE TRIGGER ALL;
ALTER TABLE water.charge_purposes ENABLE TRIGGER ALL;
ALTER TABLE water.charge_versions ENABLE TRIGGER ALL;
ALTER TABLE water.charge_version_workflows ENABLE TRIGGER ALL;
ALTER TABLE water.licence_agreements ENABLE TRIGGER ALL;
Expand Down
Loading