migrate domna_survey_required -> domna_survey_type

Drops the too-coarse boolean column and adds a free-text
`domna_survey_type` column on hubspot_deal_data so an approver can record
the survey kind directly. Updates the Drizzle schema, the HubspotDeal
type, and the live-tracking page mapping to expose the new column.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-05-05 18:37:38 +00:00
parent 3070f2c763
commit 73a365468a
6 changed files with 8758 additions and 9 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE "hubspot_deal_data" DROP COLUMN IF EXISTS "domna_survey_required";--> statement-breakpoint
ALTER TABLE "hubspot_deal_data" ADD COLUMN "domna_survey_type" text;

File diff suppressed because it is too large Load diff

View file

@ -1352,6 +1352,13 @@
"when": 1777576507360,
"tag": "0192_colorful_quasimodo",
"breakpoints": true
},
{
"idx": 193,
"version": "7",
"when": 1777750000000,
"tag": "0193_domna_survey_type",
"breakpoints": true
}
]
}

View file

@ -1,4 +1,4 @@
import { pgTable, uuid, text, timestamp, boolean } from "drizzle-orm/pg-core";
import { pgTable, uuid, text, timestamp } from "drizzle-orm/pg-core";
import { InferModel } from "drizzle-orm";
export const hubspotDealData = pgTable("hubspot_deal_data", {
@ -66,7 +66,7 @@ export const hubspotDealData = pgTable("hubspot_deal_data", {
propertyHaltedReason: text("property_halted_reason"),
technicalApprovedMeasuresForInstall: text("technical_approved_measures_for_install"),
sentToInstallerForPricing: timestamp("sent_to_installer_for_pricing", { precision: 6, withTimezone: true }),
domnaSurveyRequired: boolean("domna_survey_required"),
domnaSurveyType: text("domna_survey_type"),
domnaSurveyDate: timestamp("domna_survey_date", { precision: 6, withTimezone: true }),
createdAt: timestamp("created_at", { precision: 6, withTimezone: true })

View file

@ -84,10 +84,7 @@ function mapDbRowToHubspotDeal(row: DealRow): HubspotDeal {
propertyHaltedDate: d.propertyHaltedDate,
propertyHaltedReason: d.propertyHaltedReason,
technicalApprovedMeasuresForInstall: d.technicalApprovedMeasuresForInstall,
// domna_survey_type column does not exist on the schema yet (slice 7) —
// surface null and let the drawer fall back to the legacy boolean.
domnaSurveyType: null,
domnaSurveyRequired: d.domnaSurveyRequired,
domnaSurveyType: d.domnaSurveyType,
domnaSurveyDate: d.domnaSurveyDate,
createdAt: d.createdAt,
updatedAt: d.updatedAt,

View file

@ -61,10 +61,7 @@ export type HubspotDeal = {
propertyHaltedDate: Date | null;
propertyHaltedReason: string | null;
technicalApprovedMeasuresForInstall: string | null;
// domnaSurveyType is the new text column added in slice 7. It may not yet
// exist in the schema; until then the legacy boolean is used as a fallback.
domnaSurveyType: string | null;
domnaSurveyRequired: boolean | null;
domnaSurveyDate: Date | null;
createdAt: Date;