Skip to content

Commit

Permalink
[DUOS-1760][risk=low] Create Dataset Joins Table (#1602)
Browse files Browse the repository at this point in the history
* created changelog which creates the dar_dataset collection

* remove console log

* changed datasetid to dataset_id

* added new line
  • Loading branch information
phendriksen100 authored Jun 10, 2022
1 parent 3de83ea commit f5ab16b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/resources/changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@
<include file="changesets/changelog-consent-79.0.xml" relativeToChangelogFile="true"/>
<include file="changesets/changelog-consent-80.0.xml" relativeToChangelogFile="true"/>
<include file="changesets/changelog-consent-81.0.xml" relativeToChangelogFile="true"/>
<include file="changesets/changelog-consent-82.0.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
31 changes: 31 additions & 0 deletions src/main/resources/changesets/changelog-consent-82.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
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.1.xsd">
<changeSet id="82.0" author="phendriksen">
<createTable tableName="dar_dataset">
<column name="dataset_id" type="bigint">
<constraints nullable="false"/>
</column>
<column name="reference_id" type="varchar(255)">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey
columnNames="dataset_id, reference_id"
constraintName="join_table_key"
tableName="dar_dataset"/>
<addForeignKeyConstraint baseColumnNames="dataset_id" baseTableName="dar_dataset" constraintName="fkDatasetId"
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
referencedColumnNames="datasetid" referencedTableName="dataset"
referencesUniqueColumn="true"/>
<addForeignKeyConstraint baseColumnNames="reference_id" baseTableName="dar_dataset" constraintName="fkReferenceId"
deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION"
referencedColumnNames="reference_id" referencedTableName="data_access_request"
referencesUniqueColumn="true"/>
<rollback>
<dropTable tableName="dar_dataset"/>
<dropForeignKeyConstraint baseTableName="dar_dataset" constraintName="fkDatasetId"/>
<dropForeignKeyConstraint baseTableName="dar_dataset" constraintName="fkReferenceId"/>
</rollback>
</changeSet>
</databaseChangeLog>

0 comments on commit f5ab16b

Please sign in to comment.