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: Rename HPI table columns, add not null constraints #164

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Dec 6, 2024

What does this PR do?

  • Renames ladcode to lad_code
  • Adds NOT NULL constraints to columns
  • Updates code to account for this constraint

Copy link

vercel bot commented Dec 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fairhold-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 4:59pm

@DafyddLlyr DafyddLlyr changed the base branch from main to dp/ghdi-table December 6, 2024 16:54
@DafyddLlyr DafyddLlyr changed the title dp/hpi table feat: Rename HPI table columns, add not null constraints Dec 6, 2024
@DafyddLlyr DafyddLlyr requested a review from a team December 6, 2024 16:55
@@ -5,6 +5,7 @@ const getHPIByITL3 = async (itl3: string): Promise<number> => {
const {
_avg: { hpi2000: averageHpi },
} = await prisma.hPI.aggregate({
// TODO: Should there be a relationship on ITL3?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not quite sure what you mean by this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One to talk through next week and add to the backlog I think. We're currently just string matching on the start/end of an itl3 in multiple tables.

What we might actually want to model is an ITL3 table, with relationships to other tables. This would be more efficient when it comes to queries and allow us to join multiple tables. Something like this maybe?

model Itl3 {
  id          Int       @id @default(autoincrement())
  code        String    @unique @db.VarChar(250)
  name        String    @db.VarChar(250)
  
  // Relationships
  GDHI        GDHI[]
  HPI         HPI[]
  Rent        Rent[]
  SocialRentEarnings SocialRentEarnings[]
  GasBills    GasBills[]
  ItlLookup   ItlLookup[]

  @@map("itl3")
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I see what you mean! Will make a note and we can talk through it at next dev call :)

Base automatically changed from dp/ghdi-table to main December 13, 2024 14:38
Copy link
Collaborator

@zz-hh-aa zz-hh-aa left a comment

Choose a reason for hiding this comment

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

Super, thanks!

@DafyddLlyr DafyddLlyr merged commit ec731dc into main Dec 17, 2024
5 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/hpi-table branch December 17, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants