-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
400f1b3
commit b17b109
Showing
1 changed file
with
20 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- This is a manual DB wrangle to convert Dec CCLF attribution into runouts | ||
-- We will undo this and convert back to Dec CCLF once the runout for 2024 is received | ||
|
||
BEGIN; | ||
DO $$ | ||
|
||
DECLARE cclfids integer ARRAY; | ||
BEGIN | ||
cclfids := ARRAY(SELECT id FROM cclf_files WHERE timestamp > '2023-11-30' AND type = 0 AND aco_cms_id NOT LIKE ALL(ARRAY['A999%', 'V99%', 'E999%'])); | ||
-- This array should ONLY have type == 0 | ||
|
||
-- You can store the array in Box and ensure the right IDs are affected when undoing this | ||
raise notice 'Following IDs affected: %', cclfids; | ||
-- value of 1 is runout, and 0 is not | ||
UPDATE cclf_files SET type = 1 where id = ANY(cclfids); | ||
END; | ||
|
||
$$; | ||
|
||
COMMIT; |