Skip to content

Commit

Permalink
66 Remove capital funds category enum
Browse files Browse the repository at this point in the history
 - removed instances where data is cast to capital fund category type
 - re-ran drizzle kit introspection (migration)
 - removed any references to the capital_fund_category enum
Closes #66
  • Loading branch information
horatiorosa committed Dec 4, 2024
1 parent 8578157 commit 7b8e5a0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 44 deletions.
10 changes: 0 additions & 10 deletions drizzle/migration/schema.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
68 changes: 34 additions & 34 deletions pg/model-transform/capital-planning.sql
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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,
'city-non-exempt' AS category,
'adopt' AS stage,
adopt_ccnonexempt AS value
FROM source_capital_project;
Expand All @@ -79,7 +79,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-exempt'::capital_fund_category AS category,
'city-exempt' AS category,
'adopt' AS stage,
adopt_ccexempt AS value
FROM source_capital_project;
Expand All @@ -89,7 +89,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-cost'::capital_fund_category AS category,
'city-cost' AS category,
'adopt' AS stage,
adopt_citycost AS value
FROM source_capital_project;
Expand All @@ -99,7 +99,7 @@ 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,
'non-city-state' AS category,
'adopt' AS stage,
adopt_nccstate AS value
FROM source_capital_project;
Expand All @@ -109,7 +109,7 @@ 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,
'non-city-federal' AS category,
'adopt' AS stage,
adopt_nccfederal AS value
FROM source_capital_project;
Expand All @@ -119,7 +119,7 @@ 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,
'non-city-other' AS category,
'adopt' AS stage,
adopt_nccother AS value
FROM source_capital_project;
Expand All @@ -129,7 +129,7 @@ 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,
'non-city-cost' AS category,
'adopt' AS stage,
adopt_noncitycost AS value
FROM source_capital_project;
Expand All @@ -140,7 +140,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,
'city-non-exempt' AS category,
'allocate' AS stage,
allocate_ccnonexempt AS value
FROM source_capital_project;
Expand All @@ -150,7 +150,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-exempt'::capital_fund_category AS category,
'city-exempt' AS category,
'allocate' AS stage,
allocate_ccexempt AS value
FROM source_capital_project;
Expand All @@ -160,7 +160,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-cost'::capital_fund_category AS category,
'city-cost' AS category,
'allocate' AS stage,
allocate_citycost AS value
FROM source_capital_project;
Expand All @@ -170,7 +170,7 @@ 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,
'non-city-state' AS category,
'allocate' AS stage,
allocate_nccstate AS value
FROM source_capital_project;
Expand All @@ -180,7 +180,7 @@ 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,
'non-city-federal' AS category,
'allocate' AS stage,
allocate_nccfederal AS value
FROM source_capital_project;
Expand All @@ -190,7 +190,7 @@ 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,
'non-city-other' AS category,
'allocate' AS stage,
allocate_nccother AS value
FROM source_capital_project;
Expand All @@ -201,7 +201,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,
'city-non-exempt' AS category,
'commit' AS stage,
commit_ccnonexempt AS value
FROM source_capital_project;
Expand All @@ -211,7 +211,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-exempt'::capital_fund_category AS category,
'city-exempt' AS category,
'commit' AS stage,
commit_ccexempt AS value
FROM source_capital_project;
Expand All @@ -221,7 +221,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-cost'::capital_fund_category AS category,
'city-cost' AS category,
'commit' AS stage,
commit_citycost AS value
FROM source_capital_project;
Expand All @@ -231,7 +231,7 @@ 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,
'non-city-state' AS category,
'commit' AS stage,
commit_nccstate AS value
FROM source_capital_project;
Expand All @@ -241,7 +241,7 @@ 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,
'non-city-federal' AS category,
'commit' AS stage,
commit_nccfederal AS value
FROM source_capital_project;
Expand All @@ -251,7 +251,7 @@ 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,
'non-city-other' AS category,
'commit' AS stage,
commit_nccother AS value
FROM source_capital_project;
Expand All @@ -261,7 +261,7 @@ 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,
'non-city-cost' AS category,
'commit' AS stage,
commit_noncitycost AS value
FROM source_capital_project;
Expand All @@ -272,7 +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,
'city-non-exempt' AS category,
'spent' AS stage,
spent_ccnonexempt AS value
FROM source_capital_project;
Expand All @@ -282,7 +282,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-exempt'::capital_fund_category AS category,
'city-exempt' AS category,
'spent' AS stage,
spent_ccexempt AS value
FROM source_capital_project;
Expand All @@ -292,7 +292,7 @@ SELECT
gen_random_uuid() AS id,
m_agency AS managing_code,
proj_id AS capital_project_id,
'city-cost'::capital_fund_category AS category,
'city-cost' AS category,
'spent' AS stage,
spent_citycost AS value
FROM source_capital_project;
Expand All @@ -302,7 +302,7 @@ 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,
'non-city-state' AS category,
'spent' AS stage,
spent_nccstate AS value
FROM source_capital_project;
Expand All @@ -312,7 +312,7 @@ 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,
'non-city-federal' AS category,
'spent' AS stage,
spent_nccfederal AS value
FROM source_capital_project;
Expand All @@ -322,7 +322,7 @@ 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,
'non-city-other' AS category,
'spent' AS stage,
spent_nccother AS value
FROM source_capital_project;
Expand All @@ -332,7 +332,7 @@ 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,
'non-city-cost' AS category,
'spent' AS stage,
spent_noncitycost AS value
FROM source_capital_project;
Expand Down Expand Up @@ -381,55 +381,55 @@ 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;

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;

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;

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;

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;

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;

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;

Expand Down

0 comments on commit 7b8e5a0

Please sign in to comment.