Skip to content

Commit

Permalink
feat: Add prices_paid_summary table
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Jan 8, 2025
1 parent 16500af commit 5cb8f6c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- CreateTable
CREATE TABLE "prices_paid_summary" (
"id" SERIAL NOT NULL,
"postcode" TEXT NOT NULL,
"property_type" VARCHAR(250) NOT NULL,
"granularity_level" VARCHAR(250) NOT NULL,
"average_price" DOUBLE PRECISION NOT NULL,
"transaction_count" INTEGER NOT NULL,

CONSTRAINT "prices_paid_summary_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "prices_paid_summary_postcode_property_type_idx" ON "prices_paid_summary"("postcode", "property_type");

-- CreateIndex
CREATE UNIQUE INDEX "prices_paid_summary_postcode_property_type_granularity_leve_key" ON "prices_paid_summary"("postcode", "property_type", "granularity_level");
14 changes: 14 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ model PricesPaid {
@@map("prices_paid")
}

model PricesPaidSummary {
id Int @id @default(autoincrement())
postcode String
propertyType String @map("property_type") @db.VarChar(250)
granularityLevel String @map("granularity_level") @db.VarChar(250)
averagePrice Float @map("average_price")
transactionCount Int @map("transaction_count")
@@unique([postcode, propertyType, granularityLevel])
@@index([postcode, propertyType])
@@map("prices_paid_summary")
}

model Rent {
id Int @id @default(autoincrement())
itl3 String @db.VarChar(250)
Expand Down

0 comments on commit 5cb8f6c

Please sign in to comment.