Skip to content

Commit 05c293f

Browse files
authored
chore: add liquibase changelog composite primary key (#1529)
1 parent 9dee1e9 commit 05c293f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

liquibase/changelog.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@
9595
<include file="changes/fix_operation_status_constraint.sql" relativeToChangelogFile="true"/>
9696
<!-- Adding alt_name to the geopolygon table -->
9797
<include file="changes/feat_1479.sql" relativeToChangelogFile="true"/>
98-
99-
10098
<!-- Centralized materialized view definitions.
10199
Views are rebuilt from source SQL files using runOnChange. -->
102100
<!-- Keep this at the end to ensure all table and schema changes
103101
are applied before materialized views are rebuilt. -->
104102
<include file="materialized_views/materialized_views.xml" relativeToChangelogFile="true"/>
103+
<!-- Remove filename as the primary key on databasechangelog table and add composite(id, author, filename) -->
104+
<include file="changes/update_liquibase_changelog.sql" relativeToChangelogFile="true"/>
105105
</databaseChangeLog>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- This script updates the databasechangelog aligning all environments with the correct primary key
2+
3+
-- Drop the existing PK if it exists
4+
ALTER TABLE databasechangelog
5+
DROP CONSTRAINT IF EXISTS databasechangelog_pkey;
6+
7+
-- Add the correct composite primary key
8+
ALTER TABLE databasechangelog
9+
ADD CONSTRAINT databasechangelog_pkey
10+
PRIMARY KEY (id, author, filename);

0 commit comments

Comments
 (0)