[AB-161] fixed composite foreign keys for multiple tables

This commit is contained in:
Sheldan
2020-11-22 18:38:51 +01:00
parent 1d9f2595db
commit b05a834b59
12 changed files with 36 additions and 60 deletions

View File

@@ -8,9 +8,7 @@
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="mute-table">
<createTable tableName="mute">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="mute_pkey"/>
</column>
<column name="id" type="BIGINT" />
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="reason" type="VARCHAR(255)"/>
<column name="trigger_key" type="VARCHAR(255)"/>
@@ -32,6 +30,7 @@
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="server_id, id" tableName="mute" constraintName="pk_mute" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="mute-fk_mute_channel">

View File

@@ -8,9 +8,7 @@
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="user_note-table">
<createTable tableName="user_note">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="user_note_pkey"/>
</column>
<column autoIncrement="true" name="id" type="BIGINT" />
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="note" type="VARCHAR(2000)"/>
<column name="note_user" type="BIGINT">
@@ -20,6 +18,7 @@
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="server_id, id" tableName="user_note" constraintName="pk_user_note" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="user_note-fk_user_note_user">

View File

@@ -8,9 +8,7 @@
http://www.liquibase.org/xml/ns/pro ../../dbchangelog-3.8.xsd" >
<changeSet author="Sheldan" id="warning-table">
<createTable tableName="warning">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="warning_pkey"/>
</column>
<column autoIncrement="true" name="id" type="BIGINT" />
<column name="created" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="decay_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="decayed" type="BOOLEAN"/>
@@ -27,9 +25,9 @@
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="server_id, id" tableName="warning" constraintName="pk_warning" validate="true"/>
</changeSet>
<changeSet author="Sheldan" id="warning-fk_warning_warned_user">
<addForeignKeyConstraint baseColumnNames="warned_user_id" baseTableName="warning" constraintName="fk_warning_warned_user" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="user_in_server_id" referencedTableName="user_in_server" validate="true"/>
</changeSet>