mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Merge pull request #99 from Hestia-Homes/feature/new_table_on_live_db
Feature/new table on live db
This commit is contained in:
commit
27b32e55f0
4 changed files with 3883 additions and 0 deletions
12
src/app/db/migrations/0119_marvelous_blur.sql
Normal file
12
src/app/db/migrations/0119_marvelous_blur.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
CREATE TABLE "property_status_tracker" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"hubspot_deal_id" text NOT NULL,
|
||||
"property_id" bigint NOT NULL,
|
||||
"portfolio_id" bigint NOT NULL,
|
||||
"hubspot_pipeline_id" 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
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "property_status_tracker" ADD CONSTRAINT "property_status_tracker_property_id_property_id_fk" FOREIGN KEY ("property_id") REFERENCES "public"."property"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "property_status_tracker" ADD CONSTRAINT "property_status_tracker_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;
|
||||
3835
src/app/db/migrations/meta/0119_snapshot.json
Normal file
3835
src/app/db/migrations/meta/0119_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -834,6 +834,13 @@
|
|||
"when": 1760552402393,
|
||||
"tag": "0118_lazy_gabe_jones",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 119,
|
||||
"version": "7",
|
||||
"when": 1760711090309,
|
||||
"tag": "0119_marvelous_blur",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
29
src/app/db/schema/crm/property_status_tracker.ts
Normal file
29
src/app/db/schema/crm/property_status_tracker.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { pgTable, uuid, text, bigint, timestamp } from "drizzle-orm/pg-core";
|
||||
import { InferModel } from "drizzle-orm";
|
||||
import { property } from "../property";
|
||||
import { portfolio } from "../portfolio";
|
||||
|
||||
export const propertyStatusTracker = pgTable("property_status_tracker", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
|
||||
hubspotDealId: text("hubspot_deal_id").notNull(),
|
||||
|
||||
// foreign keys
|
||||
propertyId: bigint("property_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => property.id, { onDelete: "cascade" }),
|
||||
portfolioId: bigint("portfolio_id", { mode: "bigint" })
|
||||
.notNull()
|
||||
.references(() => portfolio.id, { onDelete: "cascade" }),
|
||||
|
||||
hubspotPipelineId: text("hubspot_pipeline_id").notNull(),
|
||||
|
||||
createdAt: timestamp("created_at", { precision: 6, withTimezone: true })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
|
||||
updatedAt: timestamp("updated_at", { precision: 6, withTimezone: true })
|
||||
.defaultNow()
|
||||
.$onUpdate(() => new Date())
|
||||
.notNull(),
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue