Add version 6.2 with automatic migration, separating mix type and mix materials
continuous-integration/drone Build is passing
Details
continuous-integration/drone Build is passing
Details
This commit is contained in:
parent
af8b1538d8
commit
e9aa9e30bb
|
@ -1,7 +1,7 @@
|
|||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
group = "dev.fyloz.colorrecipesexplorer"
|
||||
version = "6.1"
|
||||
version = "6.2"
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.6.20"
|
||||
|
|
|
@ -29,14 +29,71 @@
|
|||
<changeSet id="4" author="william">
|
||||
<sql>
|
||||
UPDATE mix_type mt
|
||||
LEFT JOIN material m ON m.id = mt.material_id
|
||||
LEFT JOIN material_type mmt ON mmt.id = m.material_type_id
|
||||
SET mt.material_type_id = mmt.id
|
||||
LEFT JOIN material m
|
||||
ON m.id = mt.material_id
|
||||
LEFT JOIN material_type mmt ON mmt.id = m.material_type_id
|
||||
SET mt.material_type_id = mmt.id
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="5" author="william">
|
||||
<dropNotNullConstraint tableName="mix_type" columnName="material_id" columnDataType="bigint"/>
|
||||
<addNotNullConstraint tableName="mix_type" columnName="material_type_id" columnDataType="bigint" />
|
||||
<addNotNullConstraint tableName="mix_type" columnName="material_type_id" columnDataType="bigint"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="6" author="william">
|
||||
<createTable tableName="mix_mix_type">
|
||||
<column name="id" type="bigint" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="quantity" type="double">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="position" type="int" defaultOnNull="0">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="mix_type_id" type="bigint">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="mix_id" type="bigint">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<createIndex tableName="mix_mix_type" indexName="ix_mix_mix_type_mix_type_id">
|
||||
<column name="mix_type_id"/>
|
||||
</createIndex>
|
||||
<createIndex tableName="mix_mix_type" indexName="ix_mix_mix_type_mix_id">
|
||||
<column name="mix_id"/>
|
||||
</createIndex>
|
||||
<addForeignKeyConstraint baseColumnNames="mix_type_id" baseTableName="mix_mix_type"
|
||||
constraintName="fk_mix_mix_type_mix_type_mix_type_id"
|
||||
referencedColumnNames="id" referencedTableName="mix_type"/>
|
||||
<addForeignKeyConstraint baseColumnNames="mix_id" baseTableName="mix_mix_type"
|
||||
constraintName="fk_mix_mix_type_mix_mix_id"
|
||||
referencedColumnNames="id" referencedTableName="mix"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="7" author="william">
|
||||
<sql>
|
||||
INSERT INTO mix_mix_type (mix_type_id, mix_id, quantity, position)
|
||||
SELECT mm.mix_type_id, mm.mix_id, mm.quantity, mm.position
|
||||
FROM (SELECT mt.id as mix_type_id, mm.mix_id, mm.quantity, mm.position
|
||||
FROM mix_material mm
|
||||
LEFT JOIN mix_type mt ON mt.material_id = mm.material_id) AS mm
|
||||
WHERE mm.mix_type_id IS NOT NULL;
|
||||
</sql>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="8" author="william">
|
||||
<update tableName="updater_metadata">
|
||||
<column name="metadata_value" value="6"/>
|
||||
<where>metadata_key='version'</where>
|
||||
</update>
|
||||
<rollback>
|
||||
<update tableName="updater_metadata">
|
||||
<column name="metadata_value" value="5"/>
|
||||
<where>metadata_key='version'</where>
|
||||
</update>
|
||||
</rollback>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
Loading…
Reference in New Issue