mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Added solar schema
This commit is contained in:
parent
5f22a9f193
commit
d203bb9c27
5 changed files with 1766 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import * as portfolioSchema from "@/app/db/schema/portfolio";
|
|||
import * as propertySchema from "@/app/db/schema/property";
|
||||
import * as recommendationSchema from "@/app/db/schema/recommendations";
|
||||
import * as materialSchema from "@/app/db/schema/materials";
|
||||
import * as solarSchema from "@/app/db/schema/solar";
|
||||
import * as Relations from "@/app/db/schema/relations";
|
||||
|
||||
export const pool = new Pool({
|
||||
|
|
@ -22,6 +23,7 @@ const schema = {
|
|||
...propertySchema,
|
||||
...recommendationSchema,
|
||||
...materialSchema,
|
||||
...solarSchema,
|
||||
...Relations,
|
||||
};
|
||||
|
||||
|
|
|
|||
9
src/app/db/migrations/0071_same_puppet_master.sql
Normal file
9
src/app/db/migrations/0071_same_puppet_master.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
CREATE TABLE IF NOT EXISTS "solar" (
|
||||
"id" bigserial PRIMARY KEY NOT NULL,
|
||||
"longitude" real NOT NULL,
|
||||
"latitude" real NOT NULL,
|
||||
"uprn" text NOT NULL,
|
||||
"created_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp (6) with time zone DEFAULT now() NOT NULL,
|
||||
"api_response" jsonb NOT NULL
|
||||
);
|
||||
1715
src/app/db/migrations/meta/0071_snapshot.json
Normal file
1715
src/app/db/migrations/meta/0071_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -498,6 +498,13 @@
|
|||
"when": 1720563097899,
|
||||
"tag": "0070_sweet_riptide",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 71,
|
||||
"version": "5",
|
||||
"when": 1720603508125,
|
||||
"tag": "0071_same_puppet_master",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
33
src/app/db/schema/solar.ts
Normal file
33
src/app/db/schema/solar.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import {
|
||||
bigserial,
|
||||
text,
|
||||
timestamp,
|
||||
pgTable,
|
||||
real,
|
||||
jsonb,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { InferModel } from "drizzle-orm";
|
||||
|
||||
export const Solar = pgTable("solar", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
longitude: real("longitude").notNull(),
|
||||
latitude: real("latitude").notNull(),
|
||||
uprn: text("uprn").notNull(),
|
||||
createdAt: timestamp("created_at", {
|
||||
precision: 6,
|
||||
withTimezone: true,
|
||||
})
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
updatedAt: timestamp("updated_at", {
|
||||
precision: 6,
|
||||
withTimezone: true,
|
||||
})
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
googleApiResponse: jsonb("api_response").notNull(),
|
||||
});
|
||||
|
||||
// Define types for selecting and inserting data
|
||||
export type ApiResponse = InferModel<typeof Solar, "select">;
|
||||
export type NewApiResponse = InferModel<typeof Solar, "insert">;
|
||||
Loading…
Add table
Reference in a new issue