Skip to content

Commit

Permalink
ZNTA-1868 - use composite key for two tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Apr 27, 2017
1 parent 6c8f06f commit 458504b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ public void setTextFlow(HTextFlow textFlow) {
@AccessType("field")
@ElementCollection(fetch = FetchType.EAGER)
@JoinTable(name = "HTextFlowContentHistory", joinColumns = @JoinColumn(
name = "text_flow_history_id"),
uniqueConstraints = @UniqueConstraint(
name = "UKTextFlowContentHistory",
columnNames = "text_flow_history_id"))
name = "text_flow_history_id"))
@IndexColumn(name = "pos", nullable = false)
@Column(name = "content", nullable = false)
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ public void setVersionNum(Integer versionNum) {
@AccessType("field")
@ElementCollection(fetch = FetchType.EAGER)
@JoinTable(name = "HTextFlowTargetContentHistory",
joinColumns = @JoinColumn(name = "text_flow_target_history_id"),
uniqueConstraints = @UniqueConstraint(
name = "UKHTextFlowTargetContentHistory",
columnNames = {"text_flow_target_history_id", "pos"})
joinColumns = @JoinColumn(name = "text_flow_target_history_id")
)
@IndexColumn(name = "pos", nullable = false)
@Column(name = "content", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</changeSet>

<changeSet id="4" author="pahuang@redhat.com">
<comment>drop duplicate index and add missing index, unique constraints</comment>
<comment>drop duplicate index and add missing index</comment>
<dropIndex tableName="HTextFlowTargetHistory" indexName="Idx_lastModifiedBy" />
<createIndex tableName="TransMemoryUnit" indexName="Idx_TransMemoryUnit_tm_id">
<column name="tm_id"/>
Expand All @@ -92,10 +92,6 @@
indexName="Idx_HProjectIteration_Locale_projectIterationId">
<column name="projectIterationId"/>
</createIndex>
<addUniqueConstraint tableName="HTextFlowContentHistory"
columnNames="text_flow_history_id,pos" />
<addUniqueConstraint tableName="HTextFlowTargetContentHistory"
columnNames="text_flow_target_history_id,pos" />
</changeSet>

<changeSet id="5" author="pahuang@redhat.com">
Expand Down Expand Up @@ -128,4 +124,16 @@
<dropUniqueConstraint tableName="HProject_Glossary" constraintName="UKHProject_Glossary" />
</changeSet>

<changeSet id="9" author="pahuang@redhat.com">
<comment>modify HTextFlowContentHistory to match hibernate mapping</comment>
<dropColumn tableName="HTextFlowContentHistory" columnName="id" />
<addPrimaryKey tableName="HTextFlowContentHistory" columnNames="pos,text_flow_history_id"/>
</changeSet>

<changeSet id="10" author="pahuang@redhat.com">
<comment>modify HTextFlowTargetContentHistory to match hibernate mapping</comment>
<dropColumn tableName="HTextFlowTargetContentHistory" columnName="id" />
<addPrimaryKey tableName="HTextFlowTargetContentHistory" columnNames="pos,text_flow_target_history_id"/>
</changeSet>

</databaseChangeLog>

0 comments on commit 458504b

Please sign in to comment.