Merge pull request #99 from Hestia-Homes/feature/new_table_on_live_db

Feature/new table on live db
This commit is contained in:
KhalimCK 2025-10-17 15:51:49 +01:00 committed by GitHub
commit 27b32e55f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 3883 additions and 0 deletions

View 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;

File diff suppressed because it is too large Load diff

View file

@ -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
}
]
}

View 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(),
});