-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix aliases to be more readable; add missing sql recipe
- Loading branch information
Showing
2 changed files
with
37 additions
and
9 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
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,28 @@ | ||
-- This example finds existing project funding sources that are associated with the sources that merged | ||
-- and updates them to the new funding source. | ||
-- See https://github.com/cityofaustin/atd-moped/pull/1486 | ||
WITH funding_source_todos AS ( | ||
SELECT funding_source_id AS ids | ||
FROM | ||
moped_fund_sources | ||
WHERE | ||
funding_source_name IN ( | ||
'Austin Transportation', | ||
'Public Works' | ||
) | ||
), | ||
|
||
new_funding_source_row AS ( | ||
SELECT funding_source_id AS id | ||
FROM | ||
moped_fund_sources | ||
WHERE | ||
funding_source_name = 'Austin Transportation and Public Works' | ||
) | ||
|
||
UPDATE | ||
moped_proj_funding | ||
SET | ||
funding_source_id = (SELECT id FROM new_funding_source_row) | ||
WHERE | ||
funding_source_id IN (SELECT ids FROM funding_source_todos); |