Skip to content

Commit

Permalink
Drop legacy assistance need tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Nov 4, 2024
1 parent 18e979e commit e6240db
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"),
)
Expand Down Expand Up @@ -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"),
Expand Down
22 changes: 1 addition & 21 deletions service/src/main/resources/db/migration/R__application_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ CREATE OR REPLACE VIEW application_view (
hideFromGuardian,
transferApplication,
additionalDaycareApplication,
duplicateApplicationIds,
hasActiveAssistanceNeed
duplicateApplicationIds
) AS
SELECT
id,
Expand Down Expand Up @@ -90,7 +89,6 @@ SELECT
transferApplication,
additionalDaycareApplication,
duplicateApplicationIds,
hasActiveAssistanceNeed,
otherGuardianAgreementStatus
FROM (
WITH dup_appl AS (
Expand All @@ -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,
Expand Down Expand Up @@ -168,19 +154,13 @@ 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
LEFT JOIN placement_plan
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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TABLE assistance_basis_option_ref;
DROP TABLE assistance_basis_option;
DROP TABLE assistance_need;
1 change: 1 addition & 0 deletions service/src/main/resources/migrations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e6240db

Please sign in to comment.