-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14342 from transcom/b-21682-store-total-dependent…
…s-main B 21682 store total dependents main
- Loading branch information
Showing
6 changed files
with
160 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
migrations/app/schema/20241122155416_total_dependents_calculation.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
-- Set temp timeout due to large file modification | ||
-- Time is 5 minutes in milliseconds | ||
SET statement_timeout = 300000; | ||
SET lock_timeout = 300000; | ||
SET idle_in_transaction_session_timeout = 300000; | ||
-- Zero downtime not necessary, this is not used at this time | ||
ALTER TABLE entitlements | ||
DROP COLUMN IF EXISTS total_dependents; -- This column has never been used, this has been confirmed prior to the migration | ||
-- The calculation should only ever work if dependents 12 and under or 12 and over are present | ||
-- These fields are only present on OCONUS | ||
-- Since we don't know the number of dependents under 12 or 12 and over on CONUS moves, we don't want to default to 0 total dependents. That'd be confusing | ||
ALTER TABLE entitlements | ||
ADD COLUMN total_dependents integer GENERATED ALWAYS AS ( | ||
CASE | ||
WHEN dependents_under_twelve IS NULL AND dependents_twelve_and_over IS NULL THEN NULL | ||
ELSE COALESCE(dependents_under_twelve, 0) + COALESCE(dependents_twelve_and_over, 0) | ||
END | ||
) STORED; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters