Revert "remove liquibase"

This reverts commit 43917c0
This commit is contained in:
Anton Romanov 2018-10-30 23:07:01 +04:00
parent 679756b02b
commit 128b147bf2
9 changed files with 256 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<?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="user" id="20180301130000-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<createTable tableName="hibernate_sequences">
<column name="sequence_name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="sequence_next_hi_value" type="BIGINT"/>
</createTable>
<addPrimaryKey columnNames="sequence_name" constraintName="hibernate_sequences_pkey"
tableName="hibernate_sequences"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,38 @@
<?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="user" id="20180301140000-4">
<insert tableName="users">
<column name="id" value="1"/>
<column name="version" value="0"/>
<column name="login" value="admin"/>
<column name="password_hash" value="$2b$10$Fip4uGEPGKnxi0zIr3PYR.bPc3dX9dN8LfkDAl/8Lup6UNp76YxFi"/>
<column name="first_name" value="Admin"/>
<column name="last_name" value="Balance"/>
<column name="email" value="balance@soft.kitchen"/>
<column name="activated" value="true"/>
</insert>
</changeSet>
<changeSet author="user" id="20180301140000-5">
<insert tableName="user_roles">
<column name="name" value="ROLE_ADMIN"/>
</insert>
<insert tableName="user_roles">
<column name="name" value="ROLE_USER"/>
</insert>
</changeSet>
<changeSet author="user" id="20180301140000-6">
<insert tableName="user_role">
<column name="user_id" value="1"/>
<column name="user_role_name" value="ROLE_ADMIN"/>
</insert>
</changeSet>
<changeSet author="user" id="20180301140000-7">
<insert tableName="hibernate_sequences">
<column name="sequence_name" value="users"/>
<column name="sequence_next_hi_value" value="1"/>
</insert>
</changeSet>
</databaseChangeLog>

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="user" id="20180301140000-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<createTable tableName="users">
<column name="id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="version" type="INTEGER"/>
<column name="login" type="VARCHAR(50)">
<constraints nullable="false" unique="true"/>
</column>
<column name="password_hash" type="VARCHAR(60)">
<constraints nullable="false"/>
</column>
<column name="first_name" type="VARCHAR(50)">
<constraints nullable="false"/>
</column>
<column name="last_name" type="VARCHAR(50)">
<constraints nullable="false"/>
</column>
<column name="email" type="VARCHAR(100)">
<constraints nullable="false" unique="true"/>
</column>
<column name="activated" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="activation_key" type="VARCHAR(20)"/>
<column name="reset_key" type="VARCHAR(20)"/>
<column name="reset_date" type="VARBINARY"/>
</createTable>
<addPrimaryKey columnNames="id" constraintName="users_pkey" tableName="users"/>
</changeSet>
<changeSet author="user" id="20180301140000-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<createTable tableName="user_roles">
<column name="name" type="VARCHAR(50)">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="name" constraintName="user_roles_pkey" tableName="user_roles"/>
</changeSet>
<changeSet author="user" id="20180301140000-3" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<createTable tableName="user_role">
<column name="user_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="user_role_name" type="VARCHAR(50)">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="user_id, user_role_name" constraintName="user_role_pkey"
tableName="user_role"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,16 @@
<?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="al-f" id="20180305100000-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<addColumn tableName="users">
<column name="activation_date" type="VARBINARY"/>
</addColumn>
</changeSet>
<changeSet author="orion" id="20180305100000-2" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<modifyDataType columnName="user_id" tableName="user_role" newDataType="integer"/>
</changeSet>
<changeSet author="orion" id="20180305100000-3" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<modifyDataType columnName="id" tableName="users" newDataType="integer"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,11 @@
<?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="al-f" id="20180321_193000-1">
<sql>
update users
set password_hash='$2a$10$5UCtAX/UcNSAcLnHUJDqUO6GR4hyPwCzBfuFI81nsoaYkvNF9SGxG' where id = 1;
</sql>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,43 @@
<?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="al-f" id="20180405_110000-1" objectQuotingStrategy="QUOTE_ALL_OBJECTS">
<createTable tableName="user_sessions">
<column name="id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="version" type="INTEGER"/>
<column name="session_id" type="VARCHAR(255)">
<constraints nullable="false" unique="true"/>
</column>
<column name="ip_address" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="host" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="login_time" type="TIMESTAMP"/>
<column name="logout_time" type="TIMESTAMP"/>
<column name="user_id" type="integer">
<constraints nullable="false"/>
</column>
</createTable>
<addPrimaryKey columnNames="id" constraintName="user_sessions_pkey" tableName="user_sessions"/>
<addForeignKeyConstraint baseTableName="user_sessions" baseColumnNames="user_id"
constraintName="fk_user_sessions_users" referencedTableName="users"
referencedColumnNames="id"/>
</changeSet>
<changeSet author="al-f" id="20180405_110000-2">
<dropColumn columnName="activation_date"
tableName="users"/>
<dropColumn columnName="reset_date"
tableName="users"/>
<addColumn tableName="users">
<column name="activation_date" type="TIMESTAMP"/>
</addColumn>
<addColumn tableName="users">
<column name="reset_date" type="TIMESTAMP"/>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,15 @@
<?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="al-f" id="20180428_110000-1">
<dropColumn columnName="activation_date" tableName="users"/>
<dropColumn columnName="reset_date" tableName="users"/>
<addColumn tableName="users">
<column name="activation_date" type="TIMESTAMP"/>
</addColumn>
<addColumn tableName="users">
<column name="reset_date" type="TIMESTAMP"/>
</addColumn>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,49 @@
<?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>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" 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">
<include file="db/changelog-20180301_130000-schema.xml"/>
<include file="db/changelog-20180301_140000-schema.xml"/>
<include file="db/changelog-20180301_140000-data.xml"/>
<include file="db/changelog-20180305_100000-schema.xml"/>
<include file="db/changelog-20180321_193000-data.xml"/>
<include file="db/changelog-20180405_110000-schema.xml"/>
<include file="db/changelog-20180428_110000-schema.xml"/>
<include file="db/changelog-20180505_000000-schema.xml"/>
</databaseChangeLog>