-
Notifications
You must be signed in to change notification settings - Fork 0
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 #185 from theopensystemslab/oz/rename-gdhi-column
feat: rename gdhi column
- Loading branch information
Showing
6 changed files
with
20 additions
and
19 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 |
---|---|---|
@@ -1,23 +1,22 @@ | ||
import prisma from "./db"; | ||
|
||
const getGDHI2020ByITL3 = async (itl3: string): Promise<number> => { | ||
const getGDHIByITL3 = async (itl3: string): Promise<number> => { | ||
try { | ||
const { gdhi2020 } = await prisma.gDHI.findFirstOrThrow({ | ||
const { gdhi } = await prisma.gDHI.findFirstOrThrow({ | ||
where: { | ||
AND: { | ||
itl3: { equals: itl3 }, | ||
}, | ||
}, | ||
select: { gdhi2020: true }, | ||
select: { gdhi: true }, | ||
}); | ||
|
||
return gdhi2020; | ||
return gdhi; | ||
} catch (error) { | ||
throw Error(`Data error: Unable to find gdhi2020 for itl3 ${itl3}`); | ||
throw Error(`Data error: Unable to find gdhi for itl3 ${itl3}`); | ||
} | ||
}; | ||
|
||
export const gdhiRepo = { | ||
getGDHI2020ByITL3, | ||
getGDHIByITL3, | ||
}; | ||
|
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
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20241218105236_rename_gdhi_column/migration.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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "gdhi" RENAME COLUMN "gdhi_2020" TO "gdhi"; |
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