mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
property schema
This commit is contained in:
parent
4bf3ec44f2
commit
6c0ff8a1d4
1 changed files with 29 additions and 0 deletions
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