diff --git a/drizzle/migration/schema.ts b/drizzle/migration/schema.ts index 4a02a15..3985976 100644 --- a/drizzle/migration/schema.ts +++ b/drizzle/migration/schema.ts @@ -1,15 +1,5 @@ import { pgEnum } from "drizzle-orm/pg-core"; -export const capital_fund_category = pgEnum("capital_fund_category", [ - "city-non-exempt", - "city-exempt", - "city-cost", - "non-city-state", - "non-city-federal", - "non-city-other", - "non-city-cost", - "total", -]); export const capital_project_category = pgEnum("capital_project_category", [ "Fixed Asset", "Lump Sum", diff --git a/pg/model-transform/capital-planning.sql b/pg/model-transform/capital-planning.sql index b0282a5..f49417c 100644 --- a/pg/model-transform/capital-planning.sql +++ b/pg/model-transform/capital-planning.sql @@ -69,8 +69,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-non-exempt'::capital_fund_category AS category, 'adopt' AS stage, + 'city-non-exempt' AS category, adopt_ccnonexempt AS value FROM source_capital_project; @@ -79,8 +79,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-exempt'::capital_fund_category AS category, 'adopt' AS stage, + 'city-exempt' AS category, adopt_ccexempt AS value FROM source_capital_project; @@ -89,8 +89,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-cost'::capital_fund_category AS category, 'adopt' AS stage, + 'city-cost' AS category, adopt_citycost AS value FROM source_capital_project; @@ -99,8 +99,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-state'::capital_fund_category AS category, 'adopt' AS stage, + 'non-city-state' AS category, adopt_nccstate AS value FROM source_capital_project; @@ -109,8 +109,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-federal'::capital_fund_category AS category, 'adopt' AS stage, + 'non-city-federal' AS category, adopt_nccfederal AS value FROM source_capital_project; @@ -119,8 +119,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-other'::capital_fund_category AS category, 'adopt' AS stage, + 'non-city-other' AS category, adopt_nccother AS value FROM source_capital_project; @@ -129,8 +129,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-cost'::capital_fund_category AS category, 'adopt' AS stage, + 'non-city-cost' AS category, adopt_noncitycost AS value FROM source_capital_project; @@ -140,8 +140,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-non-exempt'::capital_fund_category AS category, 'allocate' AS stage, + 'city-non-exempt' AS category, allocate_ccnonexempt AS value FROM source_capital_project; @@ -150,8 +150,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-exempt'::capital_fund_category AS category, 'allocate' AS stage, + 'city-exempt' AS category, allocate_ccexempt AS value FROM source_capital_project; @@ -160,8 +160,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-cost'::capital_fund_category AS category, 'allocate' AS stage, + 'city-cost' AS category, allocate_citycost AS value FROM source_capital_project; @@ -170,8 +170,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-state'::capital_fund_category AS category, 'allocate' AS stage, + 'non-city-state' AS category, allocate_nccstate AS value FROM source_capital_project; @@ -180,8 +180,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-federal'::capital_fund_category AS category, 'allocate' AS stage, + 'non-city-federal' AS category, allocate_nccfederal AS value FROM source_capital_project; @@ -190,8 +190,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-other'::capital_fund_category AS category, 'allocate' AS stage, + 'non-city-other' AS category, allocate_nccother AS value FROM source_capital_project; @@ -201,8 +201,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-non-exempt'::capital_fund_category AS category, 'commit' AS stage, + 'city-non-exempt' AS category, commit_ccnonexempt AS value FROM source_capital_project; @@ -211,8 +211,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-exempt'::capital_fund_category AS category, 'commit' AS stage, + 'city-exempt' AS category, commit_ccexempt AS value FROM source_capital_project; @@ -221,8 +221,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-cost'::capital_fund_category AS category, 'commit' AS stage, + 'city-cost' AS category, commit_citycost AS value FROM source_capital_project; @@ -231,8 +231,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-state'::capital_fund_category AS category, 'commit' AS stage, + 'non-city-state' AS category, commit_nccstate AS value FROM source_capital_project; @@ -241,8 +241,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-federal'::capital_fund_category AS category, 'commit' AS stage, + 'non-city-federal' AS category, commit_nccfederal AS value FROM source_capital_project; @@ -251,8 +251,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-other'::capital_fund_category AS category, 'commit' AS stage, + 'non-city-other' AS category, commit_nccother AS value FROM source_capital_project; @@ -261,8 +261,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-cost'::capital_fund_category AS category, 'commit' AS stage, + 'non-city-cost' AS category, commit_noncitycost AS value FROM source_capital_project; @@ -272,9 +272,7 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-non-exempt'::capital_fund_category AS category, - 'spent' AS stage, - spent_ccnonexempt AS value + 'city-non-exempt' AS category, FROM source_capital_project; INSERT INTO capital_project_fund @@ -282,8 +280,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-exempt'::capital_fund_category AS category, 'spent' AS stage, + 'city-exempt' AS category, spent_ccexempt AS value FROM source_capital_project; @@ -292,8 +290,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'city-cost'::capital_fund_category AS category, 'spent' AS stage, + 'city-cost' AS category, spent_citycost AS value FROM source_capital_project; @@ -302,8 +300,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-state'::capital_fund_category AS category, 'spent' AS stage, + 'non-city-state' AS category, spent_nccstate AS value FROM source_capital_project; @@ -312,8 +310,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-federal'::capital_fund_category AS category, 'spent' AS stage, + 'non-city-federal' AS category, spent_nccfederal AS value FROM source_capital_project; @@ -322,8 +320,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-other'::capital_fund_category AS category, 'spent' AS stage, + 'non-city-other' AS category, spent_nccother AS value FROM source_capital_project; @@ -332,8 +330,8 @@ SELECT gen_random_uuid() AS id, m_agency AS managing_code, proj_id AS capital_project_id, - 'non-city-cost'::capital_fund_category AS category, 'spent' AS stage, + 'non-city-cost' AS category, spent_noncitycost AS value FROM source_capital_project; @@ -381,7 +379,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'city-non-exempt'::capital_fund_category AS category, + 'city-non-exempt' AS category, plannedcommit_ccnonexempt AS value FROM source_capital_commitment_id; @@ -389,7 +387,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'city-exempt'::capital_fund_category AS category, + 'city-exempt' AS category, plannedcommit_ccexempt AS value FROM source_capital_commitment_id; @@ -397,7 +395,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'non-city-state'::capital_fund_category AS category, + 'non-city-state' AS category, plannedcommit_nccstate AS value FROM source_capital_commitment_id; @@ -405,7 +403,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'non-city-federal'::capital_fund_category AS category, + 'non-city-federal' AS category, plannedcommit_nccfederal AS value FROM source_capital_commitment_id; @@ -413,7 +411,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'non-city-other'::capital_fund_category AS category, + 'non-city-other' AS category, plannedcommit_nccother AS value FROM source_capital_commitment_id; @@ -421,7 +419,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'non-city-cost'::capital_fund_category AS category, + 'non-city-cost' AS category, plannedcommit_noncitycost AS value FROM source_capital_commitment_id; @@ -429,7 +427,7 @@ INSERT INTO capital_commitment_fund SELECT gen_random_uuid() AS id, id AS capital_commitment_id, - 'total'::capital_fund_category AS category, + 'total' AS category, plannedcommit_total AS value FROM source_capital_commitment_id;