Resolve "Создание базы данных" #168

Merged
ashette merged 2 commits from 81-students-create-database into dev 2019-04-01 09:36:16 +04:00
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,6 +21,7 @@
<include file="db/changelog-20190318_000000-schema.xml"/> <include file="db/changelog-20190318_000000-schema.xml"/>
<include file="db/changelog-20190318_000001-schema.xml"/> <include file="db/changelog-20190318_000001-schema.xml"/>
<include file="db/changelog-20190327_000000-schema.xml"/> <include file="db/changelog-20190327_000000-schema.xml"/>
<include file="db/changelog-20190331_000000-schema.xml"/>
<include file="db/changelog-20190331_000010-schema.xml"/> <include file="db/changelog-20190331_000010-schema.xml"/>
<include file="db/common/changelog-20190312_130000-schema.xml"/> <include file="db/common/changelog-20190312_130000-schema.xml"/>
</databaseChangeLog> </databaseChangeLog>