Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B-22205 B-22209 B-22210 Fix TGET ingestion for good #14807

Merged
merged 21 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b90b1d3
tget composite key work
cameroncaci Feb 4, 2025
73b6d8d
Merge branch 'main' into B-22271-MAIN-OfficeUserAccountRequestIDInUse…
joeydoyecaci Feb 4, 2025
8224891
drop tac constraint
cameroncaci Feb 7, 2025
b0d8164
Merge branch 'main' into B-22271-MAIN-OfficeUserAccountRequestIDInUse…
joeydoyecaci Feb 7, 2025
c3f8e05
Merge branch 'main' into B-22166
begrohmann Feb 10, 2025
256dbe5
Merge branch 'main' into B-22271-MAIN-OfficeUserAccountRequestIDInUse…
joeydoyecaci Feb 11, 2025
7f1f186
Merge branch 'main' into B-22166
begrohmann Feb 11, 2025
389b2c1
Merge branch 'main' into B-22480-fix-prime-api-with-AK-dest-move
pambecker Feb 11, 2025
05ee3ad
Merge pull request #14785 from transcom/B-22480-fix-prime-api-with-AK…
pambecker Feb 11, 2025
8e00c9c
Merge branch 'main' into B-22271-MAIN-OfficeUserAccountRequestIDInUse…
pambecker Feb 11, 2025
abbc4f8
Merge pull request #14713 from transcom/B-22271-MAIN-OfficeUserAccoun…
pambecker Feb 11, 2025
5d580c8
Merge branch 'main' into B-22166
begrohmann Feb 12, 2025
b75a35e
Merge branch main into B-22247-MAIN
paulstonebraker Feb 12, 2025
211bdf0
Merge pull request #14796 from transcom/B-22166
deandreJones Feb 12, 2025
0205b5c
Merge branch 'main' into B-22247-MAIN
pambecker Feb 12, 2025
925952f
initial commit, leggo
danieljordan-caci Feb 6, 2025
4bbf4d2
Merge pull request #14674 from transcom/B-22247-MAIN
pambecker Feb 12, 2025
def7cad
Merge branch 'main' into MAIN-B-21939
danieljordan-caci Feb 12, 2025
3274d40
Merge pull request #14799 from transcom/MAIN-B-21939
cameroncaci Feb 13, 2025
edbde06
Merge branch 'main' of github.com:transcom/mymove into b-22205-tget-e…
cameroncaci Feb 13, 2025
d339913
Merge branch 'b-22205-tget-enhancements-main' into b-22205-tget-enhan…
cameroncaci Feb 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,9 @@
20250120214107_add_international_ntsr_service_items.up.sql
20250121153007_update_pricing_proc_to_handle_international_shuttle.up.sql
20250121184450_upd_duty_loc_B-22242.up.sql
20250122193153_drop-tac-loa-fk.up.sql
20250122193154_trdm-tac-composite-key.up.sql
20250122193234_trdm-loa-composite-key.up.sql
20250123173216_add_destination_queue_db_func_and_gbloc_view.up.sql
20250123210535_update_re_intl_transit_times_for_ak_hhg.up.sql
20250127143137_insert_nsra_re_intl_transit_times.up.sql
Expand Down
5 changes: 5 additions & 0 deletions migrations/app/schema/20250122193153_drop-tac-loa-fk.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- This constraint is a remnant of the old TGET system and is no longer needed.
-- The old TGET system was based off hard coded imports and FK setting, this `loa_id`
-- column is NOT TGET data, we don't need this. We lookup based on composite key.
ALTER TABLE transportation_accounting_codes
DROP CONSTRAINT transportation_accounting_codes_loa_id_fkey;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SET statement_timeout = 300000;
SET lock_timeout = 300000;
SET idle_in_transaction_session_timeout = 300000;

-- Identify and order any existing duplicates (Duplicates will have only existed based on old existing migration files. Our TRDM data ingester does not allow for duplicates)
WITH ordered_tacs AS (
SELECT
id,
ROW_NUMBER() OVER (
PARTITION BY tac, tac_fy_txt, tac_fn_bl_mod_cd
ORDER BY created_at DESC
) AS row_num
FROM transportation_accounting_codes
)

-- Delete duplicates, we only want the most recent
DELETE FROM transportation_accounting_codes
WHERE id IN (
SELECT id
FROM ordered_tacs
WHERE row_num > 1
);

-- Set TAC composite key, never to allow duplicates again
ALTER TABLE transportation_accounting_codes
ADD CONSTRAINT transportation_accounting_codes_tac_fy_fbmc_unique
UNIQUE (tac, tac_fy_txt, tac_fn_bl_mod_cd);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
SET statement_timeout = 300000;
SET lock_timeout = 300000;
SET idle_in_transaction_session_timeout = 300000;

-- Identify and order any existing duplicates (Duplicates will have only existed based on old existing migration files. Our TRDM data ingester does not allow for duplicates)
WITH ordered_loas AS (
SELECT
id,
ROW_NUMBER() OVER (
PARTITION BY loa_sys_id
ORDER BY created_at DESC
) AS row_num
FROM lines_of_accounting
)

-- Delete duplicates, we only want the most recent
DELETE FROM lines_of_accounting
WHERE id IN (
SELECT id
FROM ordered_loas
WHERE row_num > 1
);

-- Set LOA unique constraint
ALTER TABLE lines_of_accounting
ADD CONSTRAINT lines_of_accounting_loa_sys_id_unique
UNIQUE (loa_sys_id);