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 3, 2024
1 parent 8578157 commit c4c38d1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 46 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
70 changes: 34 additions & 36 deletions pg/model-transform/capital-planning.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -272,18 +272,16 @@ 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
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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down Expand Up @@ -381,55 +379,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 c4c38d1

Please sign in to comment.