Skip to content

Commit

Permalink
Merge pull request #6981 from deutschebank/db-contrib/waltz-6976-lf-e…
Browse files Browse the repository at this point in the history
…xt-id-defaul-val

Db contrib/waltz 6976 lf ext id defaul val
  • Loading branch information
davidwatkins73 authored Feb 8, 2024
2 parents 87a5ba4 + acae423 commit e7259c2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
45 changes: 45 additions & 0 deletions waltz-schema/src/main/resources/liquibase/db.changelog-1.58.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
</changeSet>

<changeSet id="20240119-6944-1"
dbms="postgresql"
author="OscarGreen03">
<comment>6944: add external_id to logical_flow table</comment>
<addColumn tableName="logical_flow">
Expand All @@ -34,4 +35,48 @@
</column>
</addColumn>
</changeSet>

<changeSet id="20240205-6944-2"
dbms="!postgresql"
author="woodjes">
<comment>6944: adding external id to logical_flow</comment>
<addColumn tableName="logical_flow">
<column name="external_id"
type="${external-id.type}"
defaultValueComputed="CONCAT('LF:', ${uuid.function})">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20240205-6944-3"
dbms="postgresql"
author="woodjes">
<comment>6944: adding default value to logical_flow</comment>
<update tableName="logical_flow">
<column name="external_id"
valueComputed="CONCAT('LF:', ${uuid.function})"
type="${external-id.type}"/>
<where>external_id is NULL</where>
</update>
</changeSet>

<changeSet id="20240205-6944-4"
dbms="postgresql"
author="woodjes">
<comment>6944: adding default value to logical_flow</comment>
<addNotNullConstraint tableName="logical_flow"
columnName="external_id"
columnDataType="${external-id.type}"/>
</changeSet>

<changeSet id="20240205-6944-5"
dbms="!postgresql"
author="woodjes">
<comment>6944: add unique constraint to logical flow ext id</comment>
<addUniqueConstraint tableName="logical_flow"
constraintName="idx_lf_ext_id_unique"
columnNames="external_id"/>
</changeSet>

</databaseChangeLog>
3 changes: 3 additions & 0 deletions waltz-schema/src/main/resources/liquibase/db.properties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@
<property name="false.value" value="false" dbms="postgresql"></property>
<property name="false.value" value="false" dbms="h2"></property>

<property name="uuid.function" value="gen_random_uuid()" dbms="postgresql"/>
<property name="uuid.function" value="NEWID()" dbms="mssql"/>
<property name="uuid.function" value="random_uuid()" dbms="h2"/>

<!-- COLUMN NAME OVERRIDES (to support reserved words in col name) -->
<property name="key.col" value="[key]" dbms="mssql"/>
Expand Down

0 comments on commit e7259c2

Please sign in to comment.