Skip to content

Commit

Permalink
libs: update Liquibase to 4.29.2
Browse files Browse the repository at this point in the history
Motivation:
due to compatibility breaking changes (in particular the type which is
used for BLOBs) in Liquibase we ware unable to update Liquibase version.
As a result, enhancements and bug fixes.

liqubase uses id+author to identify changesets. In case of collisions
the behavour is unpredictable, in particular, with liquibase 4.xx the
wrong changeset is selected for validation.

Modification:
Add DB specific conditional statement to explicitly handle incompatibility.

To ensure unique author+id combination.  Add a concept of changeset-pre that will
update checksums in databasechangelog to match new calculation rules
(whitespace included vs excluded) and match checksums to new ids.

`dcache database update` command as well as auto-migrate are updates to
apply `pre` changes before the main change set.

Result:
Up-to-date liquibase version.

Acked-by: Lea Morschel
Acked-by: Chris Green
Target: master
Require-book: no
Require-notes: yes
  • Loading branch information
kofemann committed Jan 29, 2025
1 parent 2b5f8bc commit 68f7ffe
Show file tree
Hide file tree
Showing 67 changed files with 232 additions and 251 deletions.
5 changes: 0 additions & 5 deletions modules/chimera/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.mattbertolini</groupId>
<artifactId>liquibase-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<!--
IMPORTANT:
This file contains changes that should be applied prior any other schema changes,
typically to fix liquibase or schema issues that prevent other changes from being applied.
-->

<changeSet id="0.1" author="tigran" runOrder="first">

<comment>
Fix liquibase issue with duplicate id and mismatching md5sums in databasechangelog table.
This change set should be applied before any other changes.
</comment>

<sql>
UPDATE databasechangelog SET id='1.1' WHERE md5sum = '7:eb2d5f1df13d6bf3d4b52079c2dfa28d';
UPDATE databasechangelog SET id='1.2' WHERE md5sum = '7:2db9e833ae19148780e5d1acc517eaa8';

UPDATE databasechangelog SET id='2.2' WHERE md5sum = '7:c26ad33e589eb3cb7c66cc1f02031475';
UPDATE databasechangelog SET id='2.3' WHERE md5sum = '7:488b677497845d9fdccc2b4735c955fa';

UPDATE databasechangelog SET id='4.1' WHERE md5sum = '7:8b55165b04c65c4cb8ccf7f93fde9faa';
UPDATE databasechangelog SET id='4.2' WHERE md5sum = '7:21ed1ac81363f72ec5be2170ce036724';

UPDATE databasechangelog SET id='5.1' WHERE md5sum = '7:d541022e08ac308078ab824a740bb062';

UPDATE databasechangelog SET id='8.1' WHERE md5sum = '7:e303e36cdcbe213f479edb598925d775';

UPDATE databasechangelog SET md5sum = '7:17fde3a5dced499d37d7e113c3bf14a2' WHERE md5sum = '7:0dfb0413e67dda74b16e1991670974e2';
UPDATE databasechangelog SET md5sum = '7:297f2f5432210942b43b820a7c49006e' WHERE md5sum = '7:9a3cd4245e7d9c0b7015a20f9c284f2d';
UPDATE databasechangelog SET md5sum = '7:cfa6167e61fdbbea4d9a580079b655d7' WHERE md5sum = '7:44f6fc5af2832715524dc0811934b1e8';
UPDATE databasechangelog SET md5sum = '7:63673bb823281f204e16ea055d7fc773' WHERE md5sum = '7:cad6a1d47963b73b743d8324812fc90e';
UPDATE databasechangelog SET md5sum = '7:da6e72eda0500b2297060186def0ff79' WHERE md5sum = '7:3d41f66591e7f446f73dc9674bc28ad2';
UPDATE databasechangelog SET md5sum = '7:ad9dc5aefb279fb9eeba204b7f530c5d' WHERE md5sum = '7:a8ede4230eb74a2e938839a057b4759b';
UPDATE databasechangelog SET md5sum = '7:1694f852b51ff02fbd77dbdd9696e6c6' WHERE md5sum = '7:aaf8f4715d07789e3d4dd67ab2e386fc';
UPDATE databasechangelog SET md5sum = '7:4850fb9e27b6eeb94026f1475ce21046' WHERE md5sum = '7:bb7bdfc499d3d8b6dcd4c7eeaae27740';
UPDATE databasechangelog SET md5sum = '7:56a6b277ee4f7412dd6fe37d4c8caf42' WHERE md5sum = '7:a9642d3a7da231497eb2535a0de81a74';
UPDATE databasechangelog SET md5sum = '7:5fdeb9b27b034c454d4b7290dbd4a496' WHERE md5sum = '7:3b105eb3c3546102f65d970ecbfad6a8';
UPDATE databasechangelog SET md5sum = '7:b7d435508913f6378ce145a93205cb29' WHERE md5sum = '7:513a5a46018019f629edb84999ab9951';
UPDATE databasechangelog SET md5sum = '7:a7f81c8063cabff046bc73d764f359da' WHERE md5sum = '7:993c78bca18f3243c0a5da7bbdf3e1f7';
UPDATE databasechangelog SET md5sum = '7:ca1d1206b2f3d25f96040115e0f148ec' WHERE md5sum = '7:981ddaa56caaee56284f3a297d6bfc58';
UPDATE databasechangelog SET md5sum = '7:53ebb0055ff1ffe98b8db3603b2ef3a8' WHERE md5sum = '7:13362e810545e19fb1314971b3a792a7';
UPDATE databasechangelog SET md5sum = '7:e4d33c563df93e5ff1ae8ecd5da9b580' WHERE md5sum = '7:16d92e6ffdfebb8cbcd781060b2bd28d';
UPDATE databasechangelog SET md5sum = '7:25edbdaaba3176e673ec2998f320152c' WHERE md5sum = '7:1b659558b3e2cd781d765cc4b6a12a0a';
UPDATE databasechangelog SET md5sum = '7:bf04aa90cf10d3c7d45f53a261d9d068' WHERE md5sum = '7:0ddcf25f9c8db3c77d2bc9ae94243b69';
UPDATE databasechangelog SET md5sum = '7:f6edddc3206e3c4cf969dd2ec5f0519c' WHERE md5sum = '7:26bbab5e7c0f6ee06e96ee884cc43fb4';
UPDATE databasechangelog SET md5sum = '7:3f20884c35f64037f350d5009ad7f96d' WHERE md5sum = '7:3db30539a9c4af64bcfbf4c96f871048';
UPDATE databasechangelog SET md5sum = '7:ea390d7581aac2e346b6a737c188473b' WHERE md5sum = '7:c5ffc178c0e360910cda240b2953e61f';
UPDATE databasechangelog SET md5sum = '7:2ccfdb189f429dc6100f718d271c3584' WHERE md5sum = '7:5dd70248d188b08da7c802bd8b3d453b';
UPDATE databasechangelog SET md5sum = '7:217ec92208dff4a295b71510d11b7f76' WHERE md5sum = '7:fcfded6e1f1683ac1499de1bf5963faf';
UPDATE databasechangelog SET md5sum = '7:1d31f4dd435e7edb1ac1c7fafaa3c6e2' WHERE md5sum = '7:f30285a387085849684cb3818cf648b4';
UPDATE databasechangelog SET md5sum = '7:159acd52b9aafb7d3f9f64aa260ec166' WHERE md5sum = '7:4286e635a0f48d0e5c451dfd359aea86';
UPDATE databasechangelog SET md5sum = '7:f8dc45ef1c6a5d2b8bbba9151096697a' WHERE md5sum = '7:bf72944bc6399456cbf80ee5db5d79a4';
UPDATE databasechangelog SET md5sum = '7:cba821b535ee0ff5564d10600a887f73' WHERE md5sum = '7:4b9d65ab81957336b743dbcd3b1da7aa';
UPDATE databasechangelog SET md5sum = '7:6be54278cca6c1a4f596e2d96cda7125' WHERE md5sum = '7:bcb909cb14c25bd7529b604069719bf1';
UPDATE databasechangelog SET md5sum = '7:d48f1eec40c3a2859afb772617434152' WHERE md5sum = '7:bc088c15ee4f6746dc97689326faf3f1';
UPDATE databasechangelog SET md5sum = '7:b08d667e01804794ca7d691f67349d07' WHERE md5sum = '7:77ac2304ee24ab0b1311a4f650db332d';
UPDATE databasechangelog SET md5sum = '7:de72da59594baac6480826e9e0b56115' WHERE md5sum = '7:94e4077cafdb821e6a5f871cf4015833';
UPDATE databasechangelog SET md5sum = '7:c7092d089bbad634e509d55ed4a74747' WHERE md5sum = '7:adec189937cafcb88b8281803702a7bd';
UPDATE databasechangelog SET md5sum = '7:16ba8ba2f34e2831835106b9528a6c72' WHERE md5sum = '7:f62f76d60268682c376885254d11ff69';
UPDATE databasechangelog SET md5sum = '7:b2bf26fc059e19de1de1885bb7c6f69d' WHERE md5sum = '7:eb2d5f1df13d6bf3d4b52079c2dfa28d';
UPDATE databasechangelog SET md5sum = '7:fd12ef3ccb2e23e914344d5b2cb86bc2' WHERE md5sum = '7:b5c2f980fde8ee51bb242c2dda9f973b';
</sql>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<!-- liquibase >= 3.5 maps BLOB to OID type by default -->
<property name="blob.type" value="bytea" dbms="postgresql"/>
<property name="blob.type" value="BLOB" dbms="oracle,h2,hsqldb"/>

<include file="org/dcache/chimera/changelog/changeset-1.8.0.xml"/>
<include file="org/dcache/chimera/changelog/changeset-1.9.2.xml"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="tigran" id="1">
<!--
Expand Down Expand Up @@ -88,7 +88,7 @@
<column name="ipnfsid" type="char(36)">
<constraints nullable="false" primaryKey="true" primaryKeyName="t_inodes_data_pkey"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_1">
Expand Down Expand Up @@ -119,7 +119,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_2">
Expand Down Expand Up @@ -150,7 +150,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_3">
Expand Down Expand Up @@ -181,7 +181,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_4">
Expand Down Expand Up @@ -212,7 +212,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_5">
Expand Down Expand Up @@ -243,7 +243,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_6">
Expand Down Expand Up @@ -274,7 +274,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_level_7">
Expand Down Expand Up @@ -305,7 +305,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ifiledata" type="BLOB"/>
<column name="ifiledata" type="${blob.type}"/>
</createTable>

<createTable tableName="t_locationinfo">
Expand Down Expand Up @@ -414,7 +414,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ivalue" type="BLOB"/>
<column name="ivalue" type="${blob.type}"/>
</createTable>

<addPrimaryKey columnNames="iparent, iname" constraintName="t_dirs_pkey" tableName="t_dirs"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="tigran" id="7.3" dbms="postgresql">
<createProcedure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="tigran" id="9" dbms="postgresql">
<createProcedure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="tigran" id="4">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="tigran" id="5">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet id="36" author="litvinse" dbms="postgresql">
<createProcedure>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="behrmann" id="1">
<comment>Create index on itagid needed by referential integrity constraint.</comment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="behrmann" id="1" dbms="postgresql">
<changeSet author="behrmann" id="1.1" dbms="postgresql">
<comment>Update trash trigger to add an itype 2 marker to trash.</comment>
<createProcedure>
DROP TRIGGER IF EXISTS tgr_locationinfo_trash ON t_inodes;
Expand Down Expand Up @@ -96,7 +96,7 @@
</rollback>
</changeSet>

<changeSet author="behrmann" id="2" dbms="hsqldb">
<changeSet author="behrmann" id="2.1" dbms="hsqldb">
<comment>Update trash trigger to add an itype 0 marker to trash.</comment>
<!-- A BEFORE DELETE trigger on t_inodes would have been easier, but hsqldb
does not allow data manipulation statements in BEFORE triggers. -->
Expand Down Expand Up @@ -134,7 +134,7 @@
<column name="ictime" type="DATETIME"/>
<column name="iatime" type="DATETIME"/>
<column name="imtime" type="DATETIME"/>
<column name="ivalue" type="BLOB"/>
<column name="ivalue" type="${blob.type}"/>
</createTable>

<sql>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.29.xsd">

<changeSet author="behrmann" id="2" dbms="postgresql">
<changeSet author="behrmann" id="2.2" dbms="postgresql">
<comment>Drop tag population trigger</comment>
<sql>
DROP TRIGGER IF EXISTS tgr_populate_tags ON t_dirs;
Expand Down Expand Up @@ -314,7 +314,7 @@
</rollback>
</changeSet>

<changeSet author="behrmann" id="4">
<changeSet author="behrmann" id="4.1">
<sql>
DELETE FROM t_dirs WHERE iname IN ('.', '..')
</sql>
Expand Down Expand Up @@ -661,7 +661,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ivalue" type="BLOB"/>
<column name="ivalue" type="${blob.type}"/>
</createTable>

<sql>
Expand Down Expand Up @@ -764,7 +764,7 @@
<column name="imtime" type="DATETIME">
<constraints nullable="false"/>
</column>
<column name="ivalue" type="BLOB"/>
<column name="ivalue" type="${blob.type}"/>
</createTable>

<sql>
Expand Down
Loading

0 comments on commit 68f7ffe

Please sign in to comment.