Skip to content

Commit

Permalink
Add derived column table and rename to fixed cols
Browse files Browse the repository at this point in the history
#CTCTOWALTZ-2558
finos#6221
  • Loading branch information
jessica-woodland-scott-db committed Sep 14, 2022
1 parent 7f5120a commit d3005e6
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 110 deletions.
166 changes: 166 additions & 0 deletions waltz-data/src/main/ddl/liquibase/db.changelog-1.45.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,170 @@
<tagDatabase tag="v1.44"/> <!-- tag the current db version, i.e. the last -->
</changeSet>

<changeSet id="20220914-6221-1"
author="woodjes">
<comment>6221: Report Grid: Add dervied column table</comment>
<createTable tableName="report_grid_derived_column_definition">
<column name="id"
type="${id.type}"
autoIncrement="true">
<constraints nullable="false"
primaryKey="true"
primaryKeyName="report_grid_derived_column_defn_pkey"/>
</column>
<column name="report_grid_id"
type="${id.type}">
<constraints nullable="false"/>
</column>
<column name="position"
type="${int.type}"
defaultValueNumeric="0">
<constraints nullable="false"/>
</column>
<column name="display_name"
type="${name.type}">
<constraints nullable="false"/>
</column>
<column name="column_description"
type="${description.type}">
<constraints nullable="true"/>
</column>
<column name="script"
type="${maxvarchar.type}">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>

<changeSet id="20220914-6221-2"
author="woodjes">
<comment>6221: Report Grid: Add dervied column table</comment>
<addForeignKeyConstraint baseTableName="report_grid_derived_column_definition"
baseColumnNames="report_grid_id"
constraintName="report_derived_column_report_grid_fk"
referencedTableName="report_grid"
referencedColumnNames="id"
onDelete="CASCADE"/>
</changeSet>

<changeSet id="20220914-6221-3"
author="woodjes">
<comment>6221: Report Grid: Rename Col Defn table to Fixed Column Definition</comment>
<renameTable oldTableName="report_grid_column_definition"
newTableName="report_grid_fixed_column_definition"/>
</changeSet>

<changeSet id="20220518-6061-4"
author="woodjes">
<dropDefaultValue tableName="report_grid_fixed_column_definition"
columnName="column_usage_kind"/>
</changeSet>

<changeSet id="20220914-6221-5"
author="woodjes">
<comment>6221: Report Grid: Drop usage kind from column defn</comment>
<dropColumn tableName="report_grid_fixed_column_definition"
columnName="column_usage_kind">
</dropColumn>
</changeSet>

<changeSet id="20220914-6221-6"
author="woodjes">
<comment>6221: Report Grid: Rename FK on fixed column defn</comment>
<dropForeignKeyConstraint baseTableName="report_grid_fixed_column_definition"
constraintName="report_column_report_grid_fk"/>
</changeSet>

<changeSet id="20220914-6221-7"
author="woodjes">
<comment>6221: Report Grid: Rename FK on fixed column defn</comment>
<addForeignKeyConstraint baseTableName="report_grid_fixed_column_definition"
baseColumnNames="report_grid_id"
constraintName="report_fixed_column_report_grid_fk"
referencedTableName="report_grid"
referencedColumnNames="id"
onDelete="CASCADE"/>
</changeSet>

<changeSet id="20220914-6221-8"
author="woodjes">
<comment>6221: Report Grid: Rename index on fixed column defn</comment>
<dropIndex tableName="report_grid_fixed_column_definition"
indexName="idx_rgcd_entity_ref_report_grid_id"/>

<createIndex tableName="report_grid_fixed_column_definition"
indexName="idx_rgfcd_entity_ref_report_grid_id"
unique="true">
<column name="report_grid_id"
type="${id.type}"/>
<column name="column_entity_kind"
type="${enum.type}"/>
<column name="column_entity_id"
type="${id.type}"/>
<column name="entity_field_reference_id"
type="${id.type}"/>
<column name="column_qualifier_kind"
type="${enum.type}"/>
<column name="column_qualifier_id"
type="${id.type}"/>
</createIndex>
</changeSet>

<changeSet id="20220914-6221-9"
author="woodjes">
<comment>6221: Report Grid: Create index on derived column defn</comment>
<createIndex tableName="report_grid_derived_column_definition"
indexName="idx_rgdcd_entity_ref_report_grid_id"
unique="true">
<column name="report_grid_id"
type="${id.type}"/>
<column name="display_name"
type="${name.type}"/>
</createIndex>
</changeSet>

<changeSet id="20220914-6221-10"
author="woodjes">
<comment>6221: Report Grid: Rename PK on fixed column defn</comment>

<dropPrimaryKey constraintName="report_grid_column_defn_pkey"
tableName="report_grid_fixed_column_definition"/>

<addPrimaryKey columnNames="id"
constraintName="report_grid_fixed_column_defn_pkey"
tableName="report_grid_fixed_column_definition"/>
</changeSet>

<changeSet id="20220914-6221-11"
author="woodjes">
<comment>6221: Report Grid: Add external id to fixed column defn</comment>
<addColumn tableName="report_grid_fixed_column_definition">
<column name="external_id"
type="${external-id.type}">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20220914-6221-12"
author="woodjes">
<comment>6221: Report Grid: Add external id to derived column defn</comment>
<addColumn tableName="report_grid_derived_column_definition">
<column name="external_id"
type="${external-id.type}">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>

<changeSet id="20220914-6221-13"
author="woodjes">
<comment>6221: Report Grid: Rename script on derived column to derivation script</comment>
<renameColumn tableName="report_grid_derived_column_definition"
oldColumnName="script"
columnDataType="${maxvarchar.type}"
newColumnName="derivation_script"/>
</changeSet>


</databaseChangeLog>
Loading

0 comments on commit d3005e6

Please sign in to comment.