-
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.
Merge pull request #1520 from cityofaustin/mike/20009_funding_view
Create database view of project funding data
- Loading branch information
Showing
4 changed files
with
45 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
1 change: 1 addition & 0 deletions
1
moped-database/migrations/1736291471358_add_proj_fund_view/down.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 @@ | ||
DROP VIEW project_funding_view; |
22 changes: 22 additions & 0 deletions
22
moped-database/migrations/1736291471358_add_proj_fund_view/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,22 @@ | ||
CREATE OR REPLACE VIEW project_funding_view AS | ||
SELECT | ||
mp.project_id, | ||
mpf.proj_funding_id, | ||
mpf.funding_amount, | ||
mpf.funding_description, | ||
mpf.fund_dept_unit, | ||
mpf.created_at, | ||
mpf.updated_at, | ||
mfs.funding_source_name, | ||
mfp.funding_program_name, | ||
mfst.funding_status_name | ||
FROM | ||
moped_project AS mp | ||
LEFT JOIN moped_proj_funding AS mpf ON mp.project_id = mpf.project_id | ||
LEFT JOIN moped_fund_sources AS mfs ON mpf.funding_source_id = mfs.funding_source_id | ||
LEFT JOIN moped_fund_programs AS mfp ON mpf.funding_program_id = mfp.funding_program_id | ||
LEFT JOIN moped_fund_status AS mfst ON mpf.funding_status_id = mfst.funding_status_id | ||
WHERE | ||
TRUE | ||
AND mp.is_deleted = FALSE | ||
AND mpf.is_deleted = FALSE; |
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,19 @@ | ||
-- Most recent migration: moped-database/migrations/1736291471358_add_proj_fund_view/up.sql | ||
|
||
CREATE OR REPLACE VIEW project_funding_view AS SELECT | ||
mp.project_id, | ||
mpf.proj_funding_id, | ||
mpf.funding_amount, | ||
mpf.funding_description, | ||
mpf.fund_dept_unit, | ||
mpf.created_at, | ||
mpf.updated_at, | ||
mfs.funding_source_name, | ||
mfp.funding_program_name, | ||
mfst.funding_status_name | ||
FROM moped_project mp | ||
LEFT JOIN moped_proj_funding mpf ON mp.project_id = mpf.project_id | ||
LEFT JOIN moped_fund_sources mfs ON mpf.funding_source_id = mfs.funding_source_id | ||
LEFT JOIN moped_fund_programs mfp ON mpf.funding_program_id = mfp.funding_program_id | ||
LEFT JOIN moped_fund_status mfst ON mpf.funding_status_id = mfst.funding_status_id | ||
WHERE true AND mp.is_deleted = false AND mpf.is_deleted = false; |