diff --git a/api/src/main/resources/liquibase.xml b/api/src/main/resources/liquibase.xml index 0fc861c..feea573 100644 --- a/api/src/main/resources/liquibase.xml +++ b/api/src/main/resources/liquibase.xml @@ -19,6 +19,7 @@ 8:f587179e90716bcda0e047348f2dc7b1 + 9:0eb2a437c8009f1b33c752ffcf930e08 @@ -59,6 +60,7 @@ 3:438b0d7c1f87e1930fc8514e764a006c 8:7e8d21d7716deb36429dafaa23d3d685 + 9:da802d9db20744dd90e1a9eba5a8036d @@ -139,6 +141,7 @@ 8:5d9f35d099b2a016695f3b49358446f1 + 9:0e37aa986011ef9af9bae45b756755c6 @@ -165,6 +168,7 @@ 3:17c3a2138b042e7572bbcdb959ba225c 8:a495f2c0c4e90e7c96e4f387cd4bc284 + 9:d63a12c5ed72f16fc8e72c619b0c2c16 @@ -237,6 +241,7 @@ 8:e1616c9385aaddae911e3659cc30b8e8 + 9:2e13b280dd9b7e419174b26ab6017af2 @@ -284,6 +289,7 @@ 8:61e50f3257e9a6afabbfd16ddb660e8b + 9:1562f34ca548184e3691f30e38be8783 @@ -332,6 +338,7 @@ 8:5f7112d12f32e484d14ed88cf5da012f + 9:67ff342ddfaddbb66dcb087f1a76c5e0 diff --git a/api/src/main/resources/liquibase/3.x-liquibase-changeSet.xml b/api/src/main/resources/liquibase/3.x-liquibase-changeSet.xml index b5948ca..d2cf15f 100644 --- a/api/src/main/resources/liquibase/3.x-liquibase-changeSet.xml +++ b/api/src/main/resources/liquibase/3.x-liquibase-changeSet.xml @@ -42,7 +42,31 @@ Migrate data from cohort leader table into cohort member attributes - + + ## Migrate data from cohort_leader table to cohort_member_attribute + ## Get Cohort Leader cohortMemberAttributeTypeID + set @cohort_member_attribute_type_id = (select cohort_member_attribute_type_id + from cohort_member_attribute_type + where uuid = 'fac24350-c855-4c32-bdcf-36c4c439f538'); + + ## Copy data + insert into cohort_member_attribute (cohort_member_id, value_reference, cohort_member_attribute_type_id, date_created, + creator, changed_by, date_changed, voided_by, date_voided, void_reason, uuid) + select cm.cohort_member_id, + cl.person_id, + @cohort_member_attribute_type_id, + cl.date_created, + cl.creator, + cl.changed_by, + cl.date_changed, + cl.voided_by, + cl.date_voided, + cl.void_reason, + cl.uuid + from cohort_leader cl + left join cohort_member cm on cm.cohort_id = cl.cohort_id + + diff --git a/api/src/main/resources/sql/copy-over-cohort-leaders.sql b/api/src/main/resources/sql/copy-over-cohort-leaders.sql deleted file mode 100644 index 00925f6..0000000 --- a/api/src/main/resources/sql/copy-over-cohort-leaders.sql +++ /dev/null @@ -1,22 +0,0 @@ -## Migrate data from cohort_leader table to cohort_member_attribute -## Get Cohort Leader cohortMemberAttributeTypeID -set @cohort_member_attribute_type_id = (select cohort_member_attribute_type_id - from cohort_member_attribute_type - where uuid = 'fac24350-c855-4c32-bdcf-36c4c439f538'); - -## Copy data -insert into cohort_member_attribute (cohort_member_id, value_reference, cohort_member_attribute_type_id, date_created, - creator, changed_by, date_changed, voided_by, date_voided, void_reason, uuid) -select cm.cohort_member_id, - cl.person_id, - @cohort_member_attribute_type_id, - cl.date_created, - cl.creator, - cl.changed_by, - cl.date_changed, - cl.voided_by, - cl.date_voided, - cl.void_reason, - cl.uuid -from cohort_leader cl - left join cohort_member cm on cm.cohort_id = cl.cohort_id