Ajout de la version 5 de la base de données

This commit is contained in:
FyloZ 2021-05-20 13:19:33 -04:00
parent fa83d3d283
commit 505b7de78b
3 changed files with 124 additions and 1 deletions

View File

@ -5,7 +5,7 @@ import java.io.FileInputStream
import java.util.*
/** The latest version of the database supported by the utility. The [DatabaseUpdaterProperties] target version cannot be higher than this. */
internal const val LATEST_DATABASE_VERSION = 4
internal const val LATEST_DATABASE_VERSION = 5
/** The key of the target version property */
internal const val PROPERTY_TARGET_VERSION = "database.target-version"

View File

@ -0,0 +1,111 @@
<?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.9.xsd">
<changeSet id="1" author="william">
<dropForeignKeyConstraint baseTableName="employee" constraintName="fk_employee_employee_group_group_id"/>
<dropIndex tableName="employee" indexName="ix_employee_group_id"/>
<renameTable oldTableName="employee" newTableName="user"/>
<createIndex tableName="user" indexName="ix_user_group_id">
<column name="group_id"/>
</createIndex>
</changeSet>
<changeSet id="2" author="william">
<dropForeignKeyConstraint baseTableName="recipe_group_information"
constraintName="fk_recipe_group_information_employee_group_group_id"/>
<renameTable oldTableName="employee_group" newTableName="user_group"/>
<addForeignKeyConstraint baseTableName="recipe_group_information" baseColumnNames="group_id"
constraintName="fk_recipe_group_information_user_group_group_id"
referencedTableName="user_group" referencedColumnNames="id"/>
<addForeignKeyConstraint baseTableName="user" baseColumnNames="group_id"
constraintName="fk_user_user_group_group_id" referencedTableName="user_group"
referencedColumnNames="id"/>
</changeSet>
<changeSet id="3" author="william">
<dropForeignKeyConstraint baseTableName="employee_permission"
constraintName="fk_employee_permission_employee_employee_id"/>
<dropIndex tableName="employee_permission" indexName="ix_employee_permission_employee_id"/>
<renameTable oldTableName="employee_permission" newTableName="user_permission"/>
<renameColumn tableName="user_permission" oldColumnName="employee_id" newColumnName="user_id"
columnDataType="bigint"/>
<addForeignKeyConstraint baseTableName="user_permission" baseColumnNames="user_id"
constraintName="fk_user_permission_user_user_id" referencedTableName="user"
referencedColumnNames="id"/>
<createIndex tableName="user_permission" indexName="ix_user_permission_user_id">
<column name="user_id"/>
</createIndex>
</changeSet>
<changeSet id="4" author="william">
<dropForeignKeyConstraint baseTableName="group_permission"
constraintName="fk_group_permission_employee_group_group_id"/>
<addForeignKeyConstraint baseTableName="group_permission" baseColumnNames="group_id"
constraintName="fk_group_permission__user_group_group_id"
referencedTableName="user_group" referencedColumnNames="id"/>
</changeSet>
<changeSet id="5" author="william">
<createTable tableName="touch_up_kit">
<column name="id" type="bigint" autoIncrement="true">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="project" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="buggy" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="company" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="quantity" type="int">
<constraints nullable="false"/>
</column>
<column name="shipping_date" type="datetime">
<constraints nullable="false"/>
</column>
<column name="finish" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="material" type="varchar(255)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="6" author="william">
<createTable tableName="touch_up_kit_product">
<column name="id" type="bigint" autoIncrement="true">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="name" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="description" type="varchar(255)"/>
<column name="quantity" type="double">
<constraints nullable="false"/>
</column>
<column name="touch_up_kit_id" type="bigint"/>
</createTable>
</changeSet>
<changeSet id="7" author="william">
<addForeignKeyConstraint baseTableName="touch_up_kit_product" baseColumnNames="touch_up_kit_id"
constraintName="fk_touch_up_kit_product_touch_up_kit_touch_up_kit_id"
referencedTableName="touch_up_kit" referencedColumnNames="id"/>
<createIndex tableName="touch_up_kit_product" indexName="ix_touch_up_kit_product_touch_up_kit_id">
<column name="touch_up_kit_id"/>
</createIndex>
</changeSet>
<changeSet id="8" author="william">
<createTable tableName="configuration">
<column name="config_key" type="varchar(255)">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="content" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="last_updated" type="datetime">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.8.xsd">
<include file="/changelogs/changelog.1.xml"/>
<include file="/changelogs/changelog.2.xml"/>
<include file="/changelogs/changelog.3.xml"/>
<include file="/changelogs/changelog.4.xml"/>
<include file="/changelogs/changelog.5.xml"/>
</databaseChangeLog>