From 7e16e1d8cc45aa669f33831a19b0be395d812ff4 Mon Sep 17 00:00:00 2001 From: Chris Green Date: Tue, 4 Feb 2025 14:08:00 -0600 Subject: [PATCH] billing: database fixes necessitated by Liquibase update Motivation: [Patch](https://rb.dcache.org/r/13594/) updating Liquibase to version 4.29 omitted a necessary checksum change for a changeset for the optional billing system. Modification: * Create a new changeset for the billing system with highest priority to update the defective checksum in the DB prior to any other changesets being evaluated. * Add a new `bean` to ensure that the new changeset is loaded prior to any others. Result: Billing system will start correctly with Liquibase 4.29. Target: master Patch: https://rb.dcache.org/r/ Requires-notes: no Requires-book: no Acked-by: --- .../dcache/services/billing/cells/billing.xml | 9 ++++++- .../db/sql/00-billing.changelog-pre.xml | 24 +++++++++++++++++++ skel/share/defaults/billing.properties | 3 +++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 modules/dcache/src/main/resources/org/dcache/services/billing/db/sql/00-billing.changelog-pre.xml diff --git a/modules/dcache/src/main/resources/org/dcache/services/billing/cells/billing.xml b/modules/dcache/src/main/resources/org/dcache/services/billing/cells/billing.xml index 856686ab660..7c0a816e789 100644 --- a/modules/dcache/src/main/resources/org/dcache/services/billing/cells/billing.xml +++ b/modules/dcache/src/main/resources/org/dcache/services/billing/cells/billing.xml @@ -137,7 +137,14 @@ - + + Database schema Pre-manager + + + + + + Database schema manager diff --git a/modules/dcache/src/main/resources/org/dcache/services/billing/db/sql/00-billing.changelog-pre.xml b/modules/dcache/src/main/resources/org/dcache/services/billing/db/sql/00-billing.changelog-pre.xml new file mode 100644 index 00000000000..d71f3a33897 --- /dev/null +++ b/modules/dcache/src/main/resources/org/dcache/services/billing/db/sql/00-billing.changelog-pre.xml @@ -0,0 +1,24 @@ + + + + + + + + Fix liquibase issue with duplicate id and mismatching md5sums in databasechangelog table. + This change set should be applied before any other changes. + + + + UPDATE databasechangelog SET md5sum = '7:4c38beef9de5e3dccd4b1b0b466d3a9f' WHERE md5sum = '7:9107e2c9760619db0aab6f1f9c1ff48f'; + + + diff --git a/skel/share/defaults/billing.properties b/skel/share/defaults/billing.properties index 9d860a74d40..7d58f188e83 100644 --- a/skel/share/defaults/billing.properties +++ b/skel/share/defaults/billing.properties @@ -490,6 +490,8 @@ billing.db.fine-grained-truncate-before=365 # To enable conditional presence of database for the dcache database commands # +(immutable)billing.db.schema.changelog-pre-when-true=org/dcache/services/billing/db/sql/00-billing.changelog-pre.xml +(immutable)billing.db.schema.changelog-pre-when-false= (immutable)billing.db.schema.changelog-when-true=org/dcache/services/billing/db/sql/billing.changelog-master.xml (immutable)billing.db.schema.changelog-when-false= @@ -498,6 +500,7 @@ billing.db.fine-grained-truncate-before=365 # the dcache database command will attempt to connect # Hence this cannot be equal to billing.db.name in this case. # +billing.db.schema.changelog-pre=${billing.db.schema.changelog-pre-when-${billing.enable.db}} billing.db.schema.changelog=${billing.db.schema.changelog-when-${billing.enable.db}} #