ng-tracker/src/main/resources/db/changelog-20180505_000000-schema.xml
2018-05-05 14:49:34 +04:00

50 lines
2.7 KiB
XML

<?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="orion" id="20180505_000000-0">
<createTable tableName="file">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="name" type="varchar(255)"/>
<column name="size" type="bigint"/>
<column name="create_date" type="timestamp"/>
<column name="data" type="bytea"/>
<column name="version" type="integer"/>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_file" tableName="file"/>
</changeSet>
<changeSet author="orion" id="20180505_000000-1">
<createTable tableName="paper">
<column name="id" type="integer">
<constraints nullable="false"/>
</column>
<column name="title" type="varchar(255)"/>
<column name="status" type="varchar(255)"/>
<column name="create_date" type="timestamp"/>
<column name="update_date" type="timestamp"/>
<column name="comment" type="varchar(255)"/>
<column name="locked" type="boolean"/>
<column name="file_id" type="integer"/>
<column name="version" type="integer"/>
</createTable>
<addPrimaryKey columnNames="id" constraintName="pk_paper" tableName="paper"/>
<addForeignKeyConstraint baseTableName="paper" baseColumnNames="file_id"
constraintName="fk_paper_file" referencedTableName="file"
referencedColumnNames="id"/>
</changeSet>
<changeSet author="orion" id="20180505_000000-2">
<createTable tableName="paper_authors">
<column name="paper_id" type="integer"/>
<column name="authors_id" type="integer"/>
</createTable>
<addForeignKeyConstraint baseTableName="paper_authors" baseColumnNames="paper_id"
constraintName="fk_paper_paper_authors" referencedTableName="paper"
referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="paper_authors" baseColumnNames="authors_id"
constraintName="fk_user_paper_authors" referencedTableName="users"
referencedColumnNames="id"/>
</changeSet>
</databaseChangeLog>