Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Add !migrated context to DB migration changelogs #83
Browse files Browse the repository at this point in the history
  • Loading branch information
knstvk committed Sep 26, 2021
1 parent 1f36acd commit 9621c62
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,44 +20,44 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<changeSet id="10" author="migrator" context="cuba">
<changeSet id="10" author="migrator" context="cuba and !migrated">
<addColumn tableName="SEC_USER">
<column name="USERNAME" type="varchar(255)"/>
<column name="ENABLED" type="boolean"/>
</addColumn>
<renameColumn tableName="SEC_USER" oldColumnName="TIME_ZONE" newColumnName="TIME_ZONE_ID"/>
</changeSet>

<changeSet id="15" author="migrator" context="cuba">
<changeSet id="15" author="migrator" context="cuba and !migrated">
<modifyDataType tableName="SEC_USER" columnName="EMAIL" newDataType="VARCHAR(255)"/>
<modifyDataType tableName="SEC_USER" columnName="TIME_ZONE_ID" newDataType="VARCHAR(255)"/>
</changeSet>

<changeSet id="20" author="migrator" context="cuba">
<changeSet id="20" author="migrator" context="cuba and !migrated">
<update tableName="SEC_USER">
<column name="PASSWORD_ENCRYPTION" valueComputed="'noop'"/>
<column name="PASSWORD" valueComputed="'1'"/>
<where>PASSWORD_ENCRYPTION is null</where>
</update>
</changeSet>

<changeSet id="30" author="migrator" context="cuba">
<changeSet id="30" author="migrator" context="cuba and !migrated">
<update tableName="SEC_USER">
<column name="USERNAME" valueComputed="LOGIN_LC"/>
<column name="ENABLED" valueComputed="ACTIVE"/>
<column name="PASSWORD" valueComputed="CONCAT('{',PASSWORD_ENCRYPTION,'}',PASSWORD)"/>
</update>
</changeSet>

<changeSet id="40" author="migrator" context="cuba">
<changeSet id="40" author="migrator" context="cuba and !migrated">
<dropNotNullConstraint columnName="LOGIN" columnDataType="varchar(50)" tableName="SEC_USER"/>
<dropNotNullConstraint columnName="LOGIN_LC" columnDataType="varchar(50)" tableName="SEC_USER"/>
<addNotNullConstraint columnDataType="VARCHAR(255)" columnName="USERNAME" tableName="SEC_USER" validate="true"/>
</changeSet>

<changeSet id="50" author="migrator" context="cuba">
<changeSet id="50" author="migrator" context="cuba and !migrated">
<insert tableName="SEC_ROLE_ASSIGNMENT" dbms="postgresql, mssql, hsqldb">
<column name="ID" value="b44d6d0f-98ce-4e15-806f-f0062d5d49ad"/>
<column name="VERSION" value="1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,43 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<!-- EntityLog -->

<changeSet id="10" author="migrator" context="cuba">
<changeSet id="10" author="migrator" context="cuba and !migrated">
<renameTable oldTableName="SEC_LOGGED_ENTITY" newTableName="AUDIT_LOGGED_ENTITY"/>
<renameTable oldTableName="SEC_LOGGED_ATTR" newTableName="AUDIT_LOGGED_ATTR"/>
<renameTable oldTableName="SEC_ENTITY_LOG" newTableName="AUDIT_ENTITY_LOG"/>
</changeSet>

<changeSet id="20" author="migrator" context="cuba">
<changeSet id="20" author="migrator" context="cuba and !migrated">
<addColumn tableName="AUDIT_ENTITY_LOG">
<column name="USERNAME" type="varchar(255)"/>
</addColumn>
</changeSet>

<changeSet id="30" author="migrator" context="cuba">
<changeSet id="30" author="migrator" context="cuba and !migrated">
<update tableName="AUDIT_ENTITY_LOG">
<column name="USERNAME" valueComputed="(select u.USERNAME from SEC_USER u where u.ID = USER_ID)"/>
</update>
</changeSet>

<!-- Entity Snapshots -->

<changeSet id="40" author="migrator" context="cuba">
<changeSet id="40" author="migrator" context="cuba and !migrated">
<renameTable oldTableName="SYS_ENTITY_SNAPSHOT" newTableName="AUDIT_ENTITY_SNAPSHOT"/>
</changeSet>

<changeSet id="50" author="migrator" context="cuba">
<changeSet id="50" author="migrator" context="cuba and !migrated">
<addColumn tableName="AUDIT_ENTITY_SNAPSHOT">
<column name="AUTHOR_USERNAME" type="varchar(255)"/>
</addColumn>
<renameColumn tableName="AUDIT_ENTITY_SNAPSHOT" oldColumnName="CREATE_TS" newColumnName="CREATED_DATE"/>
<renameColumn tableName="AUDIT_ENTITY_SNAPSHOT" oldColumnName="VIEW_XML" newColumnName="FETCH_PLAN_XML"/>
</changeSet>

<changeSet id="60" author="migrator" context="cuba">
<changeSet id="60" author="migrator" context="cuba and !migrated">
<update tableName="AUDIT_ENTITY_SNAPSHOT">
<column name="AUTHOR_USERNAME" valueComputed="(select u.USERNAME from SEC_USER u where u.ID = AUTHOR_ID)"/>
</update>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<!-- Dynamic Attributes -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<changeSet id="10" author="migrator">
<renameTable oldTableName="SYS_SENDING_MESSAGE" newTableName="EMAIL_SENDING_MESSAGE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<!-- Filters -->

<changeSet id="10" author="migrator" context="cuba">
<changeSet id="10" author="migrator" context="cuba and !migrated">
<addColumn tableName="SEC_FILTER">
<column name="USERNAME" type="varchar(255)"/>
</addColumn>
</changeSet>

<changeSet id="20" author="migrator" context="cuba">
<changeSet id="20" author="migrator" context="cuba and !migrated">
<update tableName="SEC_FILTER">
<column name="USERNAME" valueComputed="(select u.USERNAME from SEC_USER u where u.ID = USER_ID)"/>
</update>
</changeSet>

<!-- TablePresentations -->

<changeSet id="30" author="migrator" context="cuba">
<changeSet id="30" author="migrator" context="cuba and !migrated">
<renameTable oldTableName="SEC_PRESENTATION" newTableName="UI_TABLE_PRESENTATION"/>
</changeSet>

<changeSet id="40" author="migrator" context="cuba">
<changeSet id="40" author="migrator" context="cuba and !migrated">
<addColumn tableName="UI_TABLE_PRESENTATION">
<column name="USERNAME" type="varchar(255)"/>
</addColumn>
<renameColumn tableName="UI_TABLE_PRESENTATION" oldColumnName="XML" newColumnName="SETTINGS"/>
</changeSet>

<changeSet id="50" author="migrator" context="cuba">
<changeSet id="50" author="migrator" context="cuba and !migrated">
<update tableName="UI_TABLE_PRESENTATION">
<column name="USERNAME" valueComputed="(select u.USERNAME from SEC_USER u where u.ID = USER_ID)"/>
</update>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<changeSet id="10" author="migrator">
<preConditions onFail="MARK_RAN">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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.8.xsd"
context="cuba">
context="cuba and !migrated">

<changeSet id="10" author="migrator">
<preConditions onFail="MARK_RAN">
Expand Down

0 comments on commit 9621c62

Please sign in to comment.