#81 adding main tables

This commit is contained in:
ASH 2019-03-31 18:58:57 +04:00
parent 76d4c15db5
commit 4e89c65c22
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<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 author="nastya" id="20190331_000000-1">
<createTable tableName="tag">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="tagname" type="varchar(255)"/>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_tag" tableName="tag"/>
</changeSet>
<changeSet author="nastya" id="20190331_000000-2">
<createTable tableName="task">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="user_id" type="integer"/>
<column name="title" type="varchar(255)"/>
<column name="description" type="varchar(255)"/>
<column name="status" type="varchar(255)"/>
<column name="deadline_date" type="timestamp"/>
<column name="create_date" type="timestamp"/>
<column name="update_date" type="timestamp"/>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_task" tableName="task"/>
<addForeignKeyConstraint baseTableName="task" baseColumnNames="user_id"
constraintName="fk_user_task_id" referencedTableName="users"
referencedColumnNames="id"/>
</changeSet>
<changeSet author="nastya" id="20190331_000000-3">
<createTable tableName="task_tags">
<column name="task_id" type="integer"/>
<column name="tag_id" type="integer"/>
</createTable>
<addForeignKeyConstraint baseTableName="task_tags" baseColumnNames="task_id"
constraintName="fk_task_id" referencedTableName="task"
referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="task_tags" baseColumnNames="tag_id"
constraintName="fk_tag_id" referencedTableName="tag"
referencedColumnNames="id"/>
</changeSet>
<changeSet author="nastya" id="20190331_000000-4">
<addColumn tableName="deadline">
<column name="task_id" type="integer"/>
</addColumn>
<addForeignKeyConstraint baseTableName="deadline" baseColumnNames="task_id"
constraintName="fk_deadlines_task" referencedTableName="task"
referencedColumnNames="id"/>
</changeSet>
</databaseChangeLog>

View File

@ -21,5 +21,6 @@
<include file="db/changelog-20190318_000000-schema.xml"/>
<include file="db/changelog-20190318_000001-schema.xml"/>
<include file="db/changelog-20190327_000000-schema.xml"/>
<include file="db/changelog-20190331_000000-schema.xml"/>
<include file="db/common/changelog-20190312_130000-schema.xml"/>
</databaseChangeLog>