Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make itl_lookup fields required #174

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/data/itlRepo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ describe("itlRepo", () => {
expect(prisma.itlLookup.findFirstOrThrow).toHaveBeenCalledWith({
where: {
postcode: postcodeDistrict,
itl3: {
not: null,
},
},
select: {
itl3: true,
Expand Down
3 changes: 0 additions & 3 deletions app/data/itlRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ const getItl3ByPostcodeDistrict = async (
const { itl3 } = await prisma.itlLookup.findFirstOrThrow({
where: {
postcode: postcodeDistrict,
itl3: {
not: null,
},
Comment on lines -10 to -12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice how Prisma + TS catch these as being impossible conditions 👌

},
select: {
itl3: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "itl_lookup" ALTER COLUMN "postcode" SET NOT NULL,
ALTER COLUMN "district" SET NOT NULL,
ALTER COLUMN "areacode" SET NOT NULL,
ALTER COLUMN "itl3" SET NOT NULL;
8 changes: 4 additions & 4 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ model HPI {
}

model ItlLookup {
postcode String?
district String?
areacode String?
itl3 String?
postcode String
district String
areacode String
itl3 String
id Int @id @default(autoincrement())

@@map("itl_lookup")
Expand Down
Loading