diff --git a/service/src/integrationTest/kotlin/fi/espoo/evaka/pis/PersonIntegrationTest.kt b/service/src/integrationTest/kotlin/fi/espoo/evaka/pis/PersonIntegrationTest.kt index c106450a333..43b55785680 100644 --- a/service/src/integrationTest/kotlin/fi/espoo/evaka/pis/PersonIntegrationTest.kt +++ b/service/src/integrationTest/kotlin/fi/espoo/evaka/pis/PersonIntegrationTest.kt @@ -94,7 +94,6 @@ class PersonIntegrationTest : PureJdbiTest(resetDbBeforeEach = true) { PersonReference("application_other_guardian", "guardian_id"), PersonReference("assistance_action", "child_id"), PersonReference("assistance_factor", "child_id"), - PersonReference("assistance_need", "child_id"), PersonReference("assistance_need_decision", "child_id"), PersonReference("assistance_need_decision_guardian", "person_id"), PersonReference("assistance_need_preschool_decision", "child_id"), diff --git a/service/src/integrationTest/kotlin/fi/espoo/evaka/shared/db/SchemaConventionsTest.kt b/service/src/integrationTest/kotlin/fi/espoo/evaka/shared/db/SchemaConventionsTest.kt index 3c959411899..3844a0ed1ca 100644 --- a/service/src/integrationTest/kotlin/fi/espoo/evaka/shared/db/SchemaConventionsTest.kt +++ b/service/src/integrationTest/kotlin/fi/espoo/evaka/shared/db/SchemaConventionsTest.kt @@ -36,10 +36,7 @@ class SchemaConventionsTest : PureJdbiTest(resetDbBeforeEach = false) { "assistance_action", "assistance_action_option", "assistance_action_option_ref", - "assistance_basis_option", - "assistance_basis_option_ref", "assistance_factor", - "assistance_need", "assistance_need_decision", "assistance_need_decision_guardian", "assistance_need_preschool_decision", @@ -136,9 +133,7 @@ class SchemaConventionsTest : PureJdbiTest(resetDbBeforeEach = false) { "application_other_guardian", "assistance_action", "assistance_action_option", - "assistance_basis_option", "assistance_factor", - "assistance_need", "assistance_need_decision", "assistance_need_preschool_decision", "assistance_need_voucher_coefficient", @@ -432,7 +427,6 @@ class SchemaConventionsTest : PureJdbiTest(resetDbBeforeEach = false) { setOf( ColumnRef("application_note", "updated_by"), ColumnRef("assistance_action", "updated_by"), - ColumnRef("assistance_need", "updated_by"), ColumnRef("fee_alteration", "updated_by"), ColumnRef("income", "updated_by"), ) @@ -514,7 +508,6 @@ class SchemaConventionsTest : PureJdbiTest(resetDbBeforeEach = false) { setOf( ColumnRef("archived_process_history", "entered_by"), ColumnRef("assistance_action_option_ref", "option_id"), - ColumnRef("assistance_basis_option_ref", "option_id"), ColumnRef("assistance_factor", "modified_by"), ColumnRef("child_document", "content_modified_by"), ColumnRef("child_document_read", "person_id"), diff --git a/service/src/main/resources/db/migration/R__application_view.sql b/service/src/main/resources/db/migration/R__application_view.sql index 9ff133e9962..a0fdcb8d4c8 100755 --- a/service/src/main/resources/db/migration/R__application_view.sql +++ b/service/src/main/resources/db/migration/R__application_view.sql @@ -43,8 +43,7 @@ CREATE OR REPLACE VIEW application_view ( hideFromGuardian, transferApplication, additionalDaycareApplication, - duplicateApplicationIds, - hasActiveAssistanceNeed + duplicateApplicationIds ) AS SELECT id, @@ -90,7 +89,6 @@ SELECT transferApplication, additionalDaycareApplication, duplicateApplicationIds, - hasActiveAssistanceNeed, otherGuardianAgreementStatus FROM ( WITH dup_appl AS ( @@ -105,18 +103,6 @@ WITH dup_appl AS ( AND r.status = ANY ('{SENT,WAITING_PLACEMENT,WAITING_CONFIRMATION,WAITING_DECISION,WAITING_MAILING,WAITING_UNIT_CONFIRMATION}'::application_status_type[]) GROUP by l.id -), active_assistance_need AS ( - SELECT - application.child_id AS child_id, - count(*) AS active_count - FROM - application, assistance_need - WHERE - application.child_id = assistance_need.child_id - AND assistance_need.start_date <= current_date - AND assistance_need.end_date >= current_date - GROUP - BY application.child_id ) SELECT appl.id, @@ -168,10 +154,6 @@ SELECT appl.transferApplication, appl.additionalDaycareApplication, dup_appl.duplicate_application_ids AS duplicateApplicationIds, - CASE WHEN active_assistance_need.active_count > 0 - THEN true - ELSE false - END AS hasActiveAssistanceNeed, (appl.document ->> 'otherGuardianAgreementStatus') AS otherGuardianAgreementStatus FROM application appl @@ -179,8 +161,6 @@ FROM ON (placement_plan.application_id = appl.id) LEFT JOIN dup_appl ON dup_appl.id = appl.id - LEFT JOIN active_assistance_need - ON (active_assistance_need.child_id = appl.child_id) WHERE document @> '{ "docVersion": 0 }' :: JSONB diff --git a/service/src/main/resources/db/migration/V456__legacy_assistance_need_tables.sql b/service/src/main/resources/db/migration/V456__legacy_assistance_need_tables.sql new file mode 100644 index 00000000000..6e440e95432 --- /dev/null +++ b/service/src/main/resources/db/migration/V456__legacy_assistance_need_tables.sql @@ -0,0 +1,3 @@ +DROP TABLE assistance_basis_option_ref; +DROP TABLE assistance_basis_option; +DROP TABLE assistance_need; diff --git a/service/src/main/resources/migrations.txt b/service/src/main/resources/migrations.txt index 2c6ab275b2e..3eb02924622 100644 --- a/service/src/main/resources/migrations.txt +++ b/service/src/main/resources/migrations.txt @@ -451,3 +451,4 @@ V452__finance_decision_date_nullability.sql V453__email_message_type.sql V454__foster_parent_modified_metadata.sql V455__generate_invoice_ids.sql +V456__legacy_assistance_need_tables.sql