Skip to content

Commit

Permalink
named foreign keys
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu DEHARBE <mathieu.deharbe@rte-france.com>
  • Loading branch information
Mathieu-Deharbe committed Jan 15, 2025
1 parent b5e56a2 commit e2ee671
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ public class BranchCreationEntity extends EquipmentCreationEntity {
private boolean connected2;

@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinTable(
joinColumns = @JoinColumn(name = "operational_limits_groups_id"), foreignKey = @ForeignKey(name = "operational_limits_groups1_id_fk"),
inverseJoinColumns = @JoinColumn(name = "branch_id"), inverseForeignKey = @ForeignKey(name = "branch_id_fk"))
@OrderColumn(name = "pos_operationalLimitsGroups1")
private List<OperationalLimitsGroupEntity> operationalLimitsGroups1;

@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinTable(
joinColumns = @JoinColumn(name = "operational_limits_groups_id"), foreignKey = @ForeignKey(name = "operational_limits_groups2_id_fk"),
inverseJoinColumns = @JoinColumn(name = "branch_id"), inverseForeignKey = @ForeignKey(name = "branch_id_fk"))
@OrderColumn(name = "pos_operationalLimitsGroups2")
private List<OperationalLimitsGroupEntity> operationalLimitsGroups2;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet author="deharbemat (generated)" id="1736262152076-23">
<changeSet author="deharbemat (generated)" id="1736949602785-23">
<createTable tableName="line_creation_operational_limits_groups1">
<column name="line_creation_entity_id" type="UUID">
<column name="operational_limits_groups_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="line_creation_operational_limits_groups1PK"/>
</column>
<column name="operational_limits_groups1_uuid" type="UUID">
<column name="branch_id" type="UUID">
<constraints nullable="false"/>
</column>
<column name="pos_operational_limits_groups1" type="INT">
<constraints nullable="false" primaryKey="true" primaryKeyName="line_creation_operational_limits_groups1PK"/>
</column>
</createTable>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-24">
<changeSet author="deharbemat (generated)" id="1736949602785-24">
<createTable tableName="line_creation_operational_limits_groups2">
<column name="line_creation_entity_id" type="UUID">
<column name="operational_limits_groups_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="line_creation_operational_limits_groups2PK"/>
</column>
<column name="operational_limits_groups2_uuid" type="UUID">
<column name="branch_id" type="UUID">
<constraints nullable="false"/>
</column>
<column name="pos_operational_limits_groups2" type="INT">
<constraints nullable="false" primaryKey="true" primaryKeyName="line_creation_operational_limits_groups2PK"/>
</column>
</createTable>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-25">
<changeSet author="deharbemat (generated)" id="1736949602785-25">
<createTable tableName="operational_limits_group">
<column name="uuid" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="operational_limits_groupPK"/>
Expand All @@ -35,116 +35,113 @@
<column name="current_limits_id" type="UUID"/>
</createTable>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-26">
<changeSet author="deharbemat (generated)" id="1736949602785-26">
<createTable tableName="two_windings_transformer_creation_operational_limits_groups1">
<column name="two_windings_transformer_creation_entity_id" type="UUID">
<column name="operational_limits_groups_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="two_windings_transformer_creation_operational_limits_groups1PK"/>
</column>
<column name="operational_limits_groups1_uuid" type="UUID">
<column name="branch_id" type="UUID">
<constraints nullable="false"/>
</column>
<column name="pos_operational_limits_groups1" type="INT">
<constraints nullable="false" primaryKey="true" primaryKeyName="two_windings_transformer_creation_operational_limits_groups1PK"/>
</column>
</createTable>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-27">
<changeSet author="deharbemat (generated)" id="1736949602785-27">
<createTable tableName="two_windings_transformer_creation_operational_limits_groups2">
<column name="two_windings_transformer_creation_entity_id" type="UUID">
<column name="operational_limits_groups_id" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="two_windings_transformer_creation_operational_limits_groups2PK"/>
</column>
<column name="operational_limits_groups2_uuid" type="UUID">
<column name="branch_id" type="UUID">
<constraints nullable="false"/>
</column>
<column name="pos_operational_limits_groups2" type="INT">
<constraints nullable="false" primaryKey="true" primaryKeyName="two_windings_transformer_creation_operational_limits_groups2PK"/>
</column>
</createTable>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-28">
<changeSet author="deharbemat (generated)" id="1736949602785-28">
<addColumn tableName="line_creation">
<column name="selected_operational_limits_group_id1" type="varchar(255)"/>
</addColumn>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-29">
<changeSet author="deharbemat (generated)" id="1736949602785-29">
<addColumn tableName="two_windings_transformer_creation">
<column name="selected_operational_limits_group_id1" type="varchar(255)"/>
</addColumn>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-30">
<changeSet author="deharbemat (generated)" id="1736949602785-30">
<addColumn tableName="line_creation">
<column name="selected_operational_limits_group_id2" type="varchar(255)"/>
</addColumn>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-31">
<changeSet author="deharbemat (generated)" id="1736949602785-31">
<addColumn tableName="two_windings_transformer_creation">
<column name="selected_operational_limits_group_id2" type="varchar(255)"/>
</addColumn>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-35">
<addUniqueConstraint columnNames="operational_limits_groups1_uuid" constraintName="UC_LINE_CREATION_OPERATIONAL_LIMITS_GROUPS1OPERATIONAL_LIMITS_G" tableName="line_creation_operational_limits_groups1"/>
<changeSet author="deharbemat (generated)" id="1736949602785-35">
<addUniqueConstraint columnNames="branch_id" constraintName="UC_LINE_CREATION_OPERATIONAL_LIMITS_GROUPS1BRANCH_ID_COL" tableName="line_creation_operational_limits_groups1"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-36">
<addUniqueConstraint columnNames="operational_limits_groups2_uuid" constraintName="UC_LINE_CREATION_OPERATIONAL_LIMITS_GROUPS2OPERATIONAL_LIMITS_G" tableName="line_creation_operational_limits_groups2"/>
<changeSet author="deharbemat (generated)" id="1736949602785-36">
<addUniqueConstraint columnNames="branch_id" constraintName="UC_LINE_CREATION_OPERATIONAL_LIMITS_GROUPS2BRANCH_ID_COL" tableName="line_creation_operational_limits_groups2"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-40">
<changeSet author="deharbemat (generated)" id="1736949602785-40">
<addUniqueConstraint columnNames="current_limits_id" constraintName="UC_OPERATIONAL_LIMITS_GROUPCURRENT_LIMITS_ID_COL" tableName="operational_limits_group"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-41">
<addUniqueConstraint columnNames="operational_limits_groups1_uuid" constraintName="UC_TWO_WINDINGS_TRANSFORMER_CREATION_OPERATIONAL_LIMITS_GROUPS1" tableName="two_windings_transformer_creation_operational_limits_groups1"/>
<changeSet author="deharbemat (generated)" id="1736949602785-41">
<addUniqueConstraint columnNames="branch_id" constraintName="UC_TWO_WINDINGS_TRANSFORMER_CREATION_OPERATIONAL_LIMITS_GROUPS1" tableName="two_windings_transformer_creation_operational_limits_groups1"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-42">
<addUniqueConstraint columnNames="operational_limits_groups2_uuid" constraintName="UC_TWO_WINDINGS_TRANSFORMER_CREATION_OPERATIONAL_LIMITS_GROUPS2" tableName="two_windings_transformer_creation_operational_limits_groups2"/>
<changeSet author="deharbemat (generated)" id="1736949602785-42">
<addUniqueConstraint columnNames="branch_id" constraintName="UC_TWO_WINDINGS_TRANSFORMER_CREATION_OPERATIONAL_LIMITS_GROUPS2" tableName="two_windings_transformer_creation_operational_limits_groups2"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-47">
<addForeignKeyConstraint baseColumnNames="line_creation_entity_id" baseTableName="line_creation_operational_limits_groups2" constraintName="FK2ak529pjyoygelqwccwigble0" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="line_creation" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-49">
<addForeignKeyConstraint baseColumnNames="branch_id" baseTableName="line_creation_operational_limits_groups1" constraintName="branch_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-49">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups1_uuid" baseTableName="two_windings_transformer_creation_operational_limits_groups1" constraintName="FK400plqu6a94hhvakjri5k5mqh" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-50">
<addForeignKeyConstraint baseColumnNames="branch_id" baseTableName="line_creation_operational_limits_groups2" constraintName="branch_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-50">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups1_uuid" baseTableName="line_creation_operational_limits_groups1" constraintName="FK9h2rnqy3956dernqqi5tgv0h8" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-51">
<addForeignKeyConstraint baseColumnNames="branch_id" baseTableName="two_windings_transformer_creation_operational_limits_groups1" constraintName="branch_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-51">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups2_uuid" baseTableName="line_creation_operational_limits_groups2" constraintName="FKf8ioxg2h9ka6eri0dkc6jj1ps" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-52">
<addForeignKeyConstraint baseColumnNames="branch_id" baseTableName="two_windings_transformer_creation_operational_limits_groups2" constraintName="branch_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-52">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups2_uuid" baseTableName="two_windings_transformer_creation_operational_limits_groups2" constraintName="FKnv32nyh331r4x031nx5i712xw" deferrable="false" initiallyDeferred="false" referencedColumnNames="uuid" referencedTableName="operational_limits_group" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-55">
<addForeignKeyConstraint baseColumnNames="current_limits_id" baseTableName="operational_limits_group" constraintName="current_limits_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="current_limits" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-53">
<addForeignKeyConstraint baseColumnNames="line_creation_entity_id" baseTableName="line_creation_operational_limits_groups1" constraintName="FKre3y33q4ae5cxyahsglto18np" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="line_creation" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-58">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups_id" baseTableName="line_creation_operational_limits_groups1" constraintName="operational_limits_groups1_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="line_creation" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-54">
<addForeignKeyConstraint baseColumnNames="two_windings_transformer_creation_entity_id" baseTableName="two_windings_transformer_creation_operational_limits_groups1" constraintName="FKrh067hn6m9ulkif30u74qch4s" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="two_windings_transformer_creation" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-59">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups_id" baseTableName="two_windings_transformer_creation_operational_limits_groups1" constraintName="operational_limits_groups1_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="two_windings_transformer_creation" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-55">
<addForeignKeyConstraint baseColumnNames="two_windings_transformer_creation_entity_id" baseTableName="two_windings_transformer_creation_operational_limits_groups2" constraintName="FKrnltk2u7arfcnxxuuvgwj0ogy" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="two_windings_transformer_creation" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-60">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups_id" baseTableName="line_creation_operational_limits_groups2" constraintName="operational_limits_groups2_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="line_creation" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-59">
<addForeignKeyConstraint baseColumnNames="current_limits_id" baseTableName="operational_limits_group" constraintName="current_limits_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="current_limits" validate="true"/>
<changeSet author="deharbemat (generated)" id="1736949602785-61">
<addForeignKeyConstraint baseColumnNames="operational_limits_groups_id" baseTableName="two_windings_transformer_creation_operational_limits_groups2" constraintName="operational_limits_groups2_id_fk" deferrable="false" initiallyDeferred="false" referencedColumnNames="id" referencedTableName="two_windings_transformer_creation" validate="true"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-62">
<changeSet author="deharbemat (generated)" id="1736949602785-62">
<dropForeignKeyConstraint baseTableName="two_windings_transformer_creation" constraintName="current_limits_id1_2wt_fk"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-63">
<changeSet author="deharbemat (generated)" id="1736949602785-63">
<dropForeignKeyConstraint baseTableName="line_creation" constraintName="current_limits_id1_fk"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-64">
<dropForeignKeyConstraint baseTableName="line_creation" constraintName="current_limits_id2_fk"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-65">
<changeSet author="deharbemat (generated)" id="1736949602785-65">
<dropForeignKeyConstraint baseTableName="two_windings_transformer_creation" constraintName="current_limits_id2__2wt_fk"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-67">
<changeSet author="deharbemat (generated)" id="1736949602785-67">
<dropColumn columnName="current_limits_id1" tableName="line_creation"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-68">
<changeSet author="deharbemat (generated)" id="1736949602785-68">
<dropColumn columnName="current_limits_id1" tableName="two_windings_transformer_creation"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-69">
<changeSet author="deharbemat (generated)" id="1736949602785-69">
<dropColumn columnName="current_limits_id2" tableName="line_creation"/>
</changeSet>
<changeSet author="deharbemat (generated)" id="1736262152076-70">
<changeSet author="deharbemat (generated)" id="1736949602785-70">
<dropColumn columnName="current_limits_id2" tableName="two_windings_transformer_creation"/>
</changeSet>
</databaseChangeLog>
2 changes: 1 addition & 1 deletion src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,5 +331,5 @@ databaseChangeLog:
file: changesets/changelog_20250114T150006Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20250115T135946Z.xml
relativeToChangelogFile: true
file: changesets/changelog_20250107T150218Z.xml

0 comments on commit e2ee671

Please sign in to comment.