From 351173d5a900cbfb508f0fdb1c4804925ba06f0e Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 12:06:20 +0800 Subject: [PATCH 01/15] chore: remove orphan routes + dead files (agreement-printable, settings-widget, settings-catalog-booking, verify-token, concierge-expired, agent-invite-expired) Pre-existing cleanup from the orphan-route audit; rides the same release as the agent-CRM / invite-cancel / IdentitySwitcher-removal workstreams. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- app/lib/viewer-timezone.tsx | 2 +- app/routes.ts | 8 -- app/routes/agent/invite-expired.tsx | 127 ------------------ app/routes/public/agreement-printable.tsx | 151 ---------------------- app/routes/public/concierge-expired.tsx | 55 -------- app/routes/public/verify-token.tsx | 72 ----------- app/routes/settings-catalog-booking.tsx | 9 -- app/routes/settings-widget.tsx | 9 -- scripts/check-ds-tokens.mjs | 2 - 9 files changed, 1 insertion(+), 434 deletions(-) delete mode 100644 app/routes/agent/invite-expired.tsx delete mode 100644 app/routes/public/agreement-printable.tsx delete mode 100644 app/routes/public/concierge-expired.tsx delete mode 100644 app/routes/public/verify-token.tsx delete mode 100644 app/routes/settings-catalog-booking.tsx delete mode 100644 app/routes/settings-widget.tsx diff --git a/app/lib/viewer-timezone.tsx b/app/lib/viewer-timezone.tsx index 1543bacbe..34ec25b12 100644 --- a/app/lib/viewer-timezone.tsx +++ b/app/lib/viewer-timezone.tsx @@ -10,7 +10,7 @@ import { getBrowserTimeZone, TIMEZONE_OPTIONS } from "~/lib/timezones"; /** * Viewer timezone for public, unauthenticated surfaces that carry no tenant - * (observe / verify / concierge / agreement-printable). These links have no + * (observe / verify / concierge). These links have no * session context and no tenant slug, so there is no configured zone to anchor * to — the honest anchor is the viewer's own zone. Mainstream field-service * tools resolve times to the viewer's browser zone rather than defaulting diff --git a/app/routes.ts b/app/routes.ts index a0b8d3535..de84da686 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -37,7 +37,6 @@ export default [ route("verify", "routes/public/verify-offline.tsx"), route("v/:token", "routes/public/v.$token.tsx"), route("observe/inspections/:id", "routes/public/observe.tsx"), - route("concierge/expired", "routes/public/concierge-expired.tsx"), // Flow A — client redeems the agent-concierge magic link emailed as // ${APP_BASE_URL}/confirm/. Shows booking details then POSTs the // confirm and follows the server-chosen redirect (agreement / report). @@ -61,10 +60,6 @@ export default [ route("portal/:tenant", "routes/public/portal.tsx"), route("portal/:tenant/auth", "routes/public/portal-auth.tsx"), route("portal/:tenant/i/:inspectionId", "routes/public/portal-inspection.tsx"), - route( - "agreements/print/:token", - "routes/public/agreement-printable.tsx", - ), ]), // Standalone pages (own chrome, no sidebar) route("setup", "routes/setup.tsx"), @@ -79,7 +74,6 @@ export default [ ), // Standalone agent pages — no agent-layout chrome route("agent-invite/:token", "routes/agent/invite-accept.tsx"), - route("agent-invite-expired", "routes/agent/invite-expired.tsx"), route("agent-signup", "routes/agent/signup.tsx"), // Spec 3 Task 5 — core dual-mode agent front door (password + magic-link). route("agent-login", "routes/agent/login.tsx"), @@ -142,7 +136,6 @@ export default [ route("settings/automations", "routes/settings-automations.tsx"), route("settings/data", "routes/settings-data.tsx"), route("settings/compliance", "routes/settings-compliance.tsx"), - route("settings/widget", "routes/settings-widget.tsx"), route("settings/account", "routes/settings-account.tsx"), route("settings/advanced", "routes/settings-advanced.tsx"), route("settings/integrations", "routes/settings-integrations.tsx"), @@ -152,7 +145,6 @@ export default [ route("settings/inspection-types", "routes/settings-inspection-types.tsx"), route("settings/schedule", "routes/settings-schedule.tsx"), route("settings/booking", "routes/settings-booking.tsx"), - route("settings/catalog/booking", "routes/settings-catalog-booking.tsx"), route("settings/billing", "routes/settings-billing.tsx"), route("settings/usage", "routes/settings-usage.tsx"), route("settings/security", "routes/settings-security.tsx"), diff --git a/app/routes/agent/invite-expired.tsx b/app/routes/agent/invite-expired.tsx deleted file mode 100644 index 09651af81..000000000 --- a/app/routes/agent/invite-expired.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { Link, useLoaderData } from "react-router"; -import type { Route } from "./+types/invite-expired"; -import { m } from "~/paraglide/messages"; - -export function meta() { - return [{ title: m.agent_portal_invite_expired_meta_title() }]; -} - -/* ------------------------------------------------------------------ */ -/* Types */ -/* ------------------------------------------------------------------ */ - -interface ExpiredData { - reason: "expired" | "used" | "no-token" | "unknown"; - inviterName?: string; - inviterEmail?: string; - tenantName?: string; -} - -/* ------------------------------------------------------------------ */ -/* Loader */ -/* ------------------------------------------------------------------ */ - -export async function loader({ request }: Route.LoaderArgs) { - const url = new URL(request.url); - const reason = (url.searchParams.get("reason") as ExpiredData["reason"]) || "unknown"; - const inviterName = url.searchParams.get("inviterName") || undefined; - const inviterEmail = url.searchParams.get("inviterEmail") || undefined; - const tenantName = url.searchParams.get("tenantName") || undefined; - - return { reason, inviterName, inviterEmail, tenantName } satisfies ExpiredData; -} - -/* ------------------------------------------------------------------ */ -/* Content helpers */ -/* ------------------------------------------------------------------ */ - -function getHeadline(reason: ExpiredData["reason"]): string { - switch (reason) { - case "used": - return m.agent_portal_invite_expired_headline_used(); - case "no-token": - return m.agent_portal_invite_expired_headline_no_token(); - default: - return m.agent_portal_invite_expired_headline_default(); - } -} - -function getExplainer(reason: ExpiredData["reason"]): string { - switch (reason) { - case "used": - return m.agent_portal_invite_expired_explainer_used(); - case "no-token": - return m.agent_portal_invite_expired_explainer_no_token(); - default: - return m.agent_portal_invite_expired_explainer_default(); - } -} - -function buildMailto( - inviterEmail?: string, - inviterName?: string, - tenantName?: string, -): string | null { - if (!inviterEmail) return null; - const subject = m.agent_portal_invite_expired_mailto_subject(); - const bodyLines = [ - m.agent_portal_invite_expired_mailto_greeting({ name: inviterName ? " " + inviterName : "" }), - "", - m.agent_portal_invite_expired_mailto_body({ tenant: tenantName || "OpenInspection" }), - "", - m.agent_portal_invite_expired_mailto_thanks(), - ]; - return `mailto:${inviterEmail}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(bodyLines.join("\n"))}`; -} - -/* ------------------------------------------------------------------ */ -/* Page */ -/* ------------------------------------------------------------------ */ - -export default function AgentInviteExpiredPage() { - const { reason, inviterName, inviterEmail, tenantName } = - useLoaderData(); - const mailto = buildMailto(inviterEmail, inviterName, tenantName); - const inspector = inviterName || m.agent_portal_invite_expired_inspector_fallback(); - - return ( -
-
- - {m.agent_portal_invite_expired_badge()} - - -

- {getHeadline(reason)} -

- -

- {getExplainer(reason)} -

- - {mailto ? ( - - {m.agent_portal_invite_expired_ask({ inspector })} - - ) : ( - - {m.agent_portal_invite_expired_signup_instead()} - - )} - - - {m.agent_portal_invite_expired_signup_no_invite()} - -
-
- ); -} diff --git a/app/routes/public/agreement-printable.tsx b/app/routes/public/agreement-printable.tsx deleted file mode 100644 index 8352cff45..000000000 --- a/app/routes/public/agreement-printable.tsx +++ /dev/null @@ -1,151 +0,0 @@ -import { useLoaderData } from "react-router"; -import type { Route } from "./+types/agreement-printable"; -import { formatDateTime } from "~/lib/format"; -import { SanitizedHtml } from "~/components/SanitizedHtml"; -import { ViewerTimeZoneProvider, useViewerTimeZone } from "~/lib/viewer-timezone"; -import { ViewerTimeZoneNotice } from "~/components/public/ViewerTimeZoneNotice"; -import { m } from "~/paraglide/messages"; - -export function meta() { - return [{ title: m.agreement_printable_meta_title() }]; -} - -/* ------------------------------------------------------------------ */ -/* Types */ -/* ------------------------------------------------------------------ */ - -interface AgreementData { - agreementName: string; - bodyHtml: string; - clientName: string | null; - clientEmail: string; - signatureBase64: string | null; - signedAtUtcIso: string | null; - envelopeId: string; -} - -/* ------------------------------------------------------------------ */ -/* Loader */ -/* ------------------------------------------------------------------ */ - -export async function loader({ params }: Route.LoaderArgs) { - try { - const res = await fetch( - `/m2m/agreement-render/${encodeURIComponent(params.token)}`, - { credentials: "include" }, - ); - const body = res.ok ? await res.json() : {}; - const d = ((body as Record).data ?? {}) as Record; - const agreement = (Object.keys(d).length > 0 ? d : null) as AgreementData | null; - // The signed-at ISO stays raw: this m2m-rendered printable carries no tenant - // slug and no session, so there is no configured zone to anchor to. On screen - // it renders in the viewer's own browser zone; a PDF/no-JS render keeps the - // fixed UTC anchor, the correct fallback for a printed document. - return { - agreement, - error: res.ok ? null : "Not found", - }; - } catch { - return { agreement: null, error: "Service unavailable" }; - } -} - -/* ------------------------------------------------------------------ */ -/* Helper */ -/* ------------------------------------------------------------------ */ - -function ensureDataUri(b64: string | null): string { - if (!b64) return ""; - if (b64.startsWith("data:")) return b64; - return "data:image/png;base64," + b64; -} - -/* ------------------------------------------------------------------ */ -/* Page */ -/* ------------------------------------------------------------------ */ - -function AgreementPrintableBody() { - const { agreement, error } = useLoaderData(); - const tz = useViewerTimeZone(); - const signedAtFormatted = agreement?.signedAtUtcIso - ? formatDateTime(agreement.signedAtUtcIso, { locale: "en-US", timeZone: tz }) - : null; - - if (error || !agreement) { - return ( -
-

{m.agreement_printable_not_found()}

-
- ); - } - - const sigSrc = ensureDataUri(agreement.signatureBase64); - - return ( -
-

- {agreement.agreementName} -

-
- {m.agreement_printable_envelope_id({ envelopeId: agreement.envelopeId })} -
- - {/* Agreement body */} - - - {/* Signature block */} -
-
- {m.agreement_printable_signed_by()} -
-
-
- {sigSrc ? ( - {m.agreement_printable_signature_alt()} - ) : ( -
- )} -
- {agreement.clientName ?? agreement.clientEmail} -
-
- {agreement.clientEmail} -
-
-
-
- {m.agreement_printable_date_signed()} -
-
- {signedAtFormatted ?? "--"} -
-
-
-
- -
- This document constitutes a binding electronic agreement under the United States - Electronic Signatures in Global and National Commerce Act (15 U.S.C. section 7001 et seq.) - and the Uniform Electronic Transactions Act (UETA). Independent verification: see - Certificate of Completion. -
- - {agreement.signedAtUtcIso && } -
- ); -} - -export default function AgreementPrintablePage() { - return ( - - - - ); -} diff --git a/app/routes/public/concierge-expired.tsx b/app/routes/public/concierge-expired.tsx deleted file mode 100644 index bb5d9242d..000000000 --- a/app/routes/public/concierge-expired.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { useLoaderData } from "react-router"; -import type { Route } from "./+types/concierge-expired"; -import { m } from "~/paraglide/messages"; - -export function meta() { - return [{ title: m.concierge_expired_meta_title() }]; -} - -/* ------------------------------------------------------------------ */ -/* Loader */ -/* ------------------------------------------------------------------ */ - -export async function loader({ request }: Route.LoaderArgs) { - const url = new URL(request.url); - const reason = (url.searchParams.get("reason") as "expired" | "unknown" | "no-token") || "unknown"; - return { reason }; -} - -/* ------------------------------------------------------------------ */ -/* Page */ -/* ------------------------------------------------------------------ */ - -export default function ConciergeExpiredPage() { - const { reason } = useLoaderData(); - - const headline = - reason === "expired" - ? m.concierge_confirm_expired_title() - : reason === "unknown" - ? m.concierge_expired_unknown_title() - : m.concierge_expired_notoken_title(); - - const body = - reason === "expired" - ? m.concierge_expired_expired_body() - : reason === "unknown" - ? m.concierge_expired_unknown_body() - : m.concierge_expired_notoken_body(); - - return ( -
-
-
- ! -
-

- {headline} -

-

- {body} -

-
-
- ); -} diff --git a/app/routes/public/verify-token.tsx b/app/routes/public/verify-token.tsx deleted file mode 100644 index 4eaddeb7f..000000000 --- a/app/routes/public/verify-token.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { useLoaderData } from "react-router"; -import type { LoaderFunctionArgs } from "react-router"; -import { m } from "~/paraglide/messages"; - -interface VerifyStatus { - envelopeId: string; - documentTitle: string | null; - clientName: string | null; - clientEmail: string; - chainValid: boolean; - chainReason: string | null; - keyFingerprint: string | null; - keyAlgorithm: string; - eventCount: number; -} - -export function meta() { - return [{ title: m.public_verify_token_meta_title() }]; -} - -export async function loader({ params, request }: LoaderFunctionArgs) { - const token = params.token as string; - const origin = new URL(request.url).origin; - const resolveRes = await fetch(`${origin}/api/public/verify-by-token/${encodeURIComponent(token)}`); - if (!resolveRes.ok) throw new Response("Not Found", { status: 404 }); - const resolveJson = (await resolveRes.json()) as { data: { envelopeId: string } }; - const envelopeId = resolveJson.data.envelopeId; - const statusRes = await fetch(`${origin}/api/public/verify/${envelopeId}`); - if (!statusRes.ok) throw new Response("Not Found", { status: 404 }); - const statusJson = (await statusRes.json()) as { data: VerifyStatus }; - return { token, envelopeId, status: statusJson.data }; -} - -export default function VerifyToken() { - const { envelopeId, status } = useLoaderData(); - const valid = status.chainValid; - return ( -
-
-

{m.public_verify_token_heading()}

-

- {valid - ? m.public_verify_token_valid() - : m.public_verify_token_failed({ reason: status.chainReason ?? m.public_verify_token_unknown_reason() })} -

-
-
-
{m.public_verify_token_signer_label()}
-
{status.clientName ?? status.clientEmail}
-
{m.public_verify_token_document_label()}
-
{status.documentTitle ?? m.public_verify_token_untitled()}
-
{m.public_verify_token_events_label()}
-
{status.eventCount}
-
{m.public_verify_token_fingerprint_label()}
-
{status.keyFingerprint ?? "—"}
-
{m.public_verify_token_algorithm_label()}
-
{status.keyAlgorithm}
-
- -
-

- {m.public_verify_token_footer()} -

-
-
- ); -} diff --git a/app/routes/settings-catalog-booking.tsx b/app/routes/settings-catalog-booking.tsx deleted file mode 100644 index 7fed64240..000000000 --- a/app/routes/settings-catalog-booking.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { redirect } from "react-router"; - -export function loader() { - return redirect("/settings/booking"); -} - -export default function SettingsCatalogBooking() { - return null; -} diff --git a/app/routes/settings-widget.tsx b/app/routes/settings-widget.tsx deleted file mode 100644 index b02ca0793..000000000 --- a/app/routes/settings-widget.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { redirect } from "react-router"; - -export function loader() { - return redirect("/settings/booking"); -} - -export default function SettingsWidget() { - return null; -} diff --git a/scripts/check-ds-tokens.mjs b/scripts/check-ds-tokens.mjs index 8be47833f..95216d166 100644 --- a/scripts/check-ds-tokens.mjs +++ b/scripts/check-ds-tokens.mjs @@ -38,8 +38,6 @@ const SCAN_DIRS = ["app", join("packages", "shared-ui", "src")]; /** Entire files exempt from all rules. Keep this list short and justified. */ const FILE_ALLOWLIST = [ - // Print/PDF output is intentionally fixed-color (no CSS-var theming). - join("app", "routes", "public", "agreement-printable.tsx"), // Email bodies render in external clients with no dark mode / CSS vars. join("app", "components", "email-template", "EmailPreview.tsx"), // Full-screen photo-annotation studio: fixed-dark chrome in both themes, From 94929ddd9f934fc83824512b60cf09b5f8399fa4 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 12:15:54 +0800 Subject: [PATCH 02/15] feat(team): cancel + resend a pending seat invite (owner/manager) --- server/api/team.ts | 65 ++++++++++++++++++++++++ server/services/team.service.ts | 41 +++++++++++++++ tests/unit/team/cancel-invite.spec.ts | 72 +++++++++++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 tests/unit/team/cancel-invite.spec.ts diff --git a/server/api/team.ts b/server/api/team.ts index f3f0fc1c4..27552cb2e 100644 --- a/server/api/team.ts +++ b/server/api/team.ts @@ -99,6 +99,56 @@ const removeTeamMemberRoute = createRoute(withMcpMetadata({ description: "Auto-generated placeholder for deleteTeamMember (DELETE /members/{id}, team domain). TODO: replace with a real description sourced from the handler." }, { scopes: ['write'], tier: 'extended' })); +/** + * DELETE /api/team/invites/:token + * Cancels a pending seat invite (inspector or in-house agent). owner/manager + * only — seats carry billing implications. + */ +const cancelInviteRoute = createRoute(withMcpMetadata({ + method: 'delete', + path: '/invites/{token}', + tags: ["team"], + summary: 'Cancel a pending seat invite', + description: 'Hard-deletes a pending tenant_invites row that belongs to the caller tenant. 404 when the token is unknown, already accepted, or belongs to another tenant.', + middleware: [requireRole('manager', 'owner')], + request: { + params: z.object({ token: z.string().uuid().describe('The pending invite token (tenant_invites.id).') }), + }, + responses: { + 200: { + content: { 'application/json': { schema: createApiResponseSchema(z.object({ cancelled: z.boolean() })) } }, + description: 'Invite cancelled', + }, + 404: { description: 'Invite not found / not pending / cross-tenant' }, + }, + operationId: "cancelTeamInvite", +}, { scopes: ['write'], tier: 'extended' })); + +/** + * POST /api/team/invites/:token/resend + * Re-sends the invitation email for an existing pending invite. Same token, + * same 7-day expiry — no new row. owner/manager only. + */ +const resendInviteRoute = createRoute(withMcpMetadata({ + method: 'post', + path: '/invites/{token}/resend', + tags: ["team"], + summary: 'Resend a pending seat invite email', + description: 'Re-sends the invitation email for an existing pending tenant_invites row. 404 when the token is unknown, accepted, or cross-tenant.', + middleware: [requireRole('manager', 'owner')], + request: { + params: z.object({ token: z.string().uuid().describe('The pending invite token (tenant_invites.id).') }), + }, + responses: { + 200: { + content: { 'application/json': { schema: createApiResponseSchema(z.object({ resent: z.boolean() })) } }, + description: 'Invitation email re-sent', + }, + 404: { description: 'Invite not found / not pending / cross-tenant' }, + }, + operationId: "resendTeamInvite", +}, { scopes: ['write'], tier: 'extended' })); + // ─── Design System 0520 subsystem C P10.2 — team defaults ── const DefaultsSchema = z.object({ @@ -161,6 +211,21 @@ const teamRoutes = createApiRouter() return c.json({ success: true, data: { removed: true } }, 200); }) + .openapi(cancelInviteRoute, async (c) => { + const tenantId = c.get('tenantId'); + const { token } = c.req.valid('param'); + await c.var.services.team.cancelInvite(tenantId, token); + return c.json({ success: true as const, data: { cancelled: true as const } }, 200); + }) + .openapi(resendInviteRoute, async (c) => { + const tenantId = c.get('tenantId'); + const { token } = c.req.valid('param'); + const invite = await c.var.services.team.findPendingInvite(tenantId, token); + if (!invite) return c.json({ success: false as const, error: { code: 'NOT_FOUND', message: 'Invite not found' } }, 404); + const inviteLink = `${getBaseUrl(c)}/join?token=${token}`; + await c.var.services.email.sendInvitation(invite.email, inviteLink); + return c.json({ success: true as const, data: { resent: true as const } }, 200); + }) /** GET /api/team/defaults — read the team-page toggles. */ .openapi(withMcpMetadata({ method: 'get', path: '/defaults', diff --git a/server/services/team.service.ts b/server/services/team.service.ts index 42bc4e07a..f363ec448 100644 --- a/server/services/team.service.ts +++ b/server/services/team.service.ts @@ -120,6 +120,47 @@ export class TeamService { return { token: inviteToken, expiresAt }; } + /** + * Cancel (hard-delete) a pending seat invite. Only rows that belong to the + * caller's tenant AND are still `status='pending'` are deletable — accepted + * invites are history (a real users row exists) and cross-tenant ids are + * invisible. Unlike removeMember (which soft-deletes a live users row), a + * pending invite has no FK dependents, so a hard delete is safe and leaves + * no dead row. Throws NotFound so the route returns 404 for every miss. + */ + async cancelInvite(tenantId: string, token: string): Promise { + const db = this.getDB(); + const invite = await db.select({ id: tenantInvites.id }).from(tenantInvites) + .where(and( + eq(tenantInvites.id, token), + eq(tenantInvites.tenantId, tenantId), + eq(tenantInvites.status, 'pending'), + )) + .get(); + if (!invite) throw Errors.NotFound('Invite not found'); + await db.delete(tenantInvites) + .where(and(eq(tenantInvites.id, token), eq(tenantInvites.tenantId, tenantId))); + } + + /** + * Look up a pending invite's email for the resend path. Tenant-scoped + + * pending-only, same visibility rule as cancelInvite. Returns null (→ 404) + * for unknown / accepted / cross-tenant tokens. The route reconstructs the + * /join link and re-sends the email; the token and its 7-day expiry are + * unchanged (resend, not re-issue). + */ + async findPendingInvite(tenantId: string, token: string): Promise<{ email: string } | null> { + const db = this.getDB(); + const row = await db.select({ email: tenantInvites.email }).from(tenantInvites) + .where(and( + eq(tenantInvites.id, token), + eq(tenantInvites.tenantId, tenantId), + eq(tenantInvites.status, 'pending'), + )) + .get(); + return row ?? null; + } + /** * Reduce a requested override map to only the capabilities whose value * differs from the role's template default. Returns null when nothing diff --git a/tests/unit/team/cancel-invite.spec.ts b/tests/unit/team/cancel-invite.spec.ts new file mode 100644 index 000000000..8e458b6ed --- /dev/null +++ b/tests/unit/team/cancel-invite.spec.ts @@ -0,0 +1,72 @@ +import { describe, it, expect, beforeEach, vi } from 'vitest'; +import { and, eq } from 'drizzle-orm'; +import { TeamService } from '../../../server/services/team.service'; +import { createTestDb, setupSchema } from '../db'; +import * as schema from '../../../server/lib/db/schema'; +import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'; + +vi.mock('drizzle-orm/d1', () => ({ drizzle: vi.fn() })); +import { drizzle as mockDrizzle } from 'drizzle-orm/d1'; + +const TENANT_A = '11111111-1111-1111-1111-1111111111a1'; +const TENANT_B = '22222222-2222-2222-2222-2222222222b2'; +const PENDING = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1'; +const ACCEPTED = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbb1'; +const OTHER_T = 'cccccccc-cccc-cccc-cccc-ccccccccccc1'; + +async function seed(db: BetterSQLite3Database) { + await db.insert(schema.tenants).values([ + { id: TENANT_A, name: 'A', slug: 'a', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }, + { id: TENANT_B, name: 'B', slug: 'b', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }, + ]); + await db.insert(schema.tenantInvites).values([ + { id: PENDING, tenantId: TENANT_A, email: 'p@a.test', role: 'inspector', status: 'pending', expiresAt: new Date(Date.now() + 1e9) }, + { id: ACCEPTED, tenantId: TENANT_A, email: 'x@a.test', role: 'inspector', status: 'accepted', expiresAt: new Date(Date.now() + 1e9) }, + { id: OTHER_T, tenantId: TENANT_B, email: 'o@b.test', role: 'agent', status: 'pending', expiresAt: new Date(Date.now() + 1e9) }, + ]); +} + +describe('TeamService.cancelInvite', () => { + let db: BetterSQLite3Database; + let svc: TeamService; + beforeEach(async () => { + const fix = createTestDb(); + db = fix.db; + await setupSchema(fix.sqlite); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (mockDrizzle as any).mockReturnValue(db); + await seed(db); + svc = new TeamService({} as D1Database); + }); + + it('hard-deletes a pending invite in the caller tenant', async () => { + await svc.cancelInvite(TENANT_A, PENDING); + const rows = await db.select().from(schema.tenantInvites).where(eq(schema.tenantInvites.id, PENDING)).all(); + expect(rows).toHaveLength(0); + }); + + it('rejects an accepted invite (not pending)', async () => { + await expect(svc.cancelInvite(TENANT_A, ACCEPTED)).rejects.toThrow(/not found/i); + }); + + it('rejects a cross-tenant invite', async () => { + await expect(svc.cancelInvite(TENANT_A, OTHER_T)).rejects.toThrow(/not found/i); + const still = await db.select().from(schema.tenantInvites) + .where(and(eq(schema.tenantInvites.id, OTHER_T), eq(schema.tenantInvites.tenantId, TENANT_B))).all(); + expect(still).toHaveLength(1); + }); + + it('rejects an unknown token', async () => { + await expect(svc.cancelInvite(TENANT_A, '00000000-0000-0000-0000-000000000000')).rejects.toThrow(/not found/i); + }); + + it('findPendingInvite returns the email for a pending in-tenant invite', async () => { + expect(await svc.findPendingInvite(TENANT_A, PENDING)).toEqual({ email: 'p@a.test' }); + }); + + it('findPendingInvite returns null for accepted / cross-tenant / unknown', async () => { + expect(await svc.findPendingInvite(TENANT_A, ACCEPTED)).toBeNull(); + expect(await svc.findPendingInvite(TENANT_A, OTHER_T)).toBeNull(); + expect(await svc.findPendingInvite(TENANT_A, '00000000-0000-0000-0000-000000000000')).toBeNull(); + }); +}); From 8aca51dafdd112a8cad17b7cc18353ce1c27e503 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 12:31:34 +0800 Subject: [PATCH 03/15] feat(team): pending-invite cancel/resend UI with expiry + confirm modal --- app/routes/team.tsx | 137 +++++++++++++++++++++++++++++++++----- messages/en/settings.json | 8 ++- 2 files changed, 129 insertions(+), 16 deletions(-) diff --git a/app/routes/team.tsx b/app/routes/team.tsx index 1d64b69ae..5636c804f 100644 --- a/app/routes/team.tsx +++ b/app/routes/team.tsx @@ -1,10 +1,11 @@ import { useState } from "react"; -import { useLoaderData } from "react-router"; +import { useLoaderData, useFetcher } from "react-router"; import type { Route } from "./+types/team"; import { requireToken } from "~/lib/session.server"; import { createApi } from "~/lib/api-client.server"; import { SeatBanner } from "~/components/SeatBanner"; import { InviteSeatDrawer } from "~/components/modals/InviteSeatDrawer"; +import { ConfirmDialog } from "~/components/ConfirmDialog"; import { useSessionContext } from "~/hooks/useSessionContext"; import { Breadcrumb } from "~/components/Breadcrumb"; import { PageHeader, TabStrip, Card, Pill, Button, EmptyState, Table } from "@core/shared-ui"; @@ -19,25 +20,72 @@ interface Member { name: string | null; email: string; role: string; - status: string; + status: "active" | "pending"; lastActiveAt: string | null; + /** Present only on pending rows — the tenant_invites token to cancel/resend. */ + token: string | null; + /** Present only on pending rows — ISO expiry for the "expires in Nd" label. */ + expiresAt: string | null; } +interface LoaderActiveUser { id: string; email: string; role: string; name?: string | null } +interface LoaderInvite { id: string; email: string; role: string; expiresAt: string } + export async function loader({ request, context }: Route.LoaderArgs) { const token = await requireToken(context, request); + const api = createApi(context, { token }); + + // Resolve the caller role so the cancel affordance is hidden for inspectors + // (server enforces owner/manager regardless — this is just UI hygiene). + let role: string | undefined; + try { + const ctxRes = await api.sessionContext.context.$get(); + if (ctxRes.ok) { + const b = (await ctxRes.json()) as { data?: { user?: { role?: string } } }; + role = b.data?.user?.role; + } + } catch { + role = undefined; + } + try { - const api = createApi(context, { token }); const res = await api.team.members.$get(); - const body = res.ok ? ((await res.json()) as unknown as { data?: { members?: Member[] } }) : { data: { members: [] as Member[] } }; - return { - members: (body.data?.members ?? []) as Member[], - settings: {} as Record, - }; + const body = res.ok + ? ((await res.json()) as unknown as { data?: { members?: LoaderActiveUser[]; invites?: LoaderInvite[] } }) + : { data: { members: [], invites: [] } }; + const active: Member[] = (body.data?.members ?? []).map((u) => ({ + id: u.id, name: u.name ?? null, email: u.email, role: u.role, + status: "active", lastActiveAt: null, token: null, expiresAt: null, + })); + const pending: Member[] = (body.data?.invites ?? []).map((i) => ({ + id: i.id, name: null, email: i.email, role: i.role, + status: "pending", lastActiveAt: null, token: i.id, expiresAt: i.expiresAt, + })); + return { members: [...active, ...pending], canManage: role === "owner" || role === "manager" }; } catch { - return { members: [] as Member[], settings: {} }; + return { members: [] as Member[], canManage: false }; } } +export async function action({ request, context }: Route.ActionArgs) { + const token = await requireToken(context, request); + const form = await request.formData(); + const intent = form.get("intent") as string; + const api = createApi(context, { token }); + + if (intent === "cancel-invite") { + const inviteToken = form.get("token") as string; + const res = await api.team.invites[":token"].$delete({ param: { token: inviteToken } }); + return { ok: res.ok }; + } + if (intent === "resend-invite") { + const inviteToken = form.get("token") as string; + const res = await api.team.invites[":token"].resend.$post({ param: { token: inviteToken } }); + return { ok: res.ok, resent: res.ok }; + } + return { ok: false }; +} + const ROLE_TONES: Record = { owner: "primary", manager: "info", @@ -49,11 +97,24 @@ const ROLE_TONES: Record(); + const { members, canManage } = useLoaderData(); + const cancelFetcher = useFetcher<{ ok?: boolean }>(); + const resendFetcher = useFetcher<{ ok?: boolean; resent?: boolean }>(); + const [pendingCancel, setPendingCancel] = useState<{ token: string; email: string } | null>(null); const sessionCtx = useSessionContext(); const [activeTab, setActiveTab] = useState("active"); const [inviteOpen, setInviteOpen] = useState(false); + // Human "expires in Nd" / "expired Nd ago" from an ISO expiry. Whole-day + // granularity is enough for a 7-day invite window. + function expiryLabel(iso: string | null): string { + if (!iso) return ""; + const ms = new Date(iso).getTime() - Date.now(); + const days = Math.round(Math.abs(ms) / 86_400_000); + if (ms <= 0) return m.settings_team_invite_expired({ days }); + return m.settings_team_invite_expires_in({ days }); + } + // Built in the render (request ALS scope) so the labels resolve per-request // rather than freezing the locale at module import. const TABS = [ @@ -145,11 +206,39 @@ export default function TeamPage() { { label: "", align: "right", - cell: () => ( - - ), + cell: (member) => + member.status === "pending" && member.token ? ( +
+ + {expiryLabel(member.expiresAt)} + + {canManage && ( + <> + + + + + + + + )} +
+ ) : member.status === "active" ? ( + + ) : null, }, ]} /> @@ -173,6 +262,24 @@ export default function TeamPage() { ))}
+ + { + if (pendingCancel) { + cancelFetcher.submit( + { intent: "cancel-invite", token: pendingCancel.token }, + { method: "post" }, + ); + setPendingCancel(null); + } + }} + onCancel={() => setPendingCancel(null)} + /> ); } diff --git a/messages/en/settings.json b/messages/en/settings.json index a0e3ca66f..71e6304c4 100644 --- a/messages/en/settings.json +++ b/messages/en/settings.json @@ -217,5 +217,11 @@ "settings_team_role_inspector_name": "Inspector", "settings_team_role_inspector_desc": "Conducts inspections; edits and publishes reports.", "settings_team_role_agent_name": "Agent", - "settings_team_role_agent_desc": "External agent. Read-only access to their own orders." + "settings_team_role_agent_desc": "External agent. Read-only access to their own orders.", + "settings_team_cancel_invite": "Cancel invite", + "settings_team_resend_invite": "Resend", + "settings_team_invite_expires_in": "Expires in {days}d", + "settings_team_invite_expired": "Expired {days}d ago", + "settings_team_cancel_invite_title": "Cancel this invite?", + "settings_team_cancel_invite_confirm": "The invite to {email} will be revoked. They will no longer be able to join with the emailed link." } From 0fd577873e5a25d887f28a4d5adaac168e855851 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 12:58:43 +0800 Subject: [PATCH 04/15] feat(contacts): archive-or-delete, referral count, freeze agent email --- scripts/tenant-scoping-baseline.json | 2 +- server/lib/validations/contact.schema.ts | 1 + server/services/contact.service.ts | 44 +++++++-- ...chived-contact-referral-visibility.spec.ts | 59 +++++++++++ .../contacts/archive-and-immutability.spec.ts | 99 +++++++++++++++++++ 5 files changed, 197 insertions(+), 8 deletions(-) create mode 100644 tests/unit/agents/archived-contact-referral-visibility.spec.ts create mode 100644 tests/unit/contacts/archive-and-immutability.spec.ts diff --git a/scripts/tenant-scoping-baseline.json b/scripts/tenant-scoping-baseline.json index 405fa5250..f07ccf01a 100644 --- a/scripts/tenant-scoping-baseline.json +++ b/scripts/tenant-scoping-baseline.json @@ -55,7 +55,7 @@ "server/services/automation/report-email.ts:141", "server/services/concierge.service.ts:381", "server/services/concierge.service.ts:456", - "server/services/contact.service.ts:217", + "server/services/contact.service.ts:247", "server/services/email/transactional.ts:156", "server/services/event.service.ts:128", "server/services/inspection/inspection-annotations.service.ts:157", diff --git a/server/lib/validations/contact.schema.ts b/server/lib/validations/contact.schema.ts index 27b7594c6..56482ad09 100644 --- a/server/lib/validations/contact.schema.ts +++ b/server/lib/validations/contact.schema.ts @@ -23,6 +23,7 @@ export const ContactResponseSchema = z.object({ notes: z.string().nullable().describe('TODO describe notes field for the OpenInspection MCP integration'), createdAt: z.string().describe('TODO describe createdAt field for the OpenInspection MCP integration'), inspectionCount: z.number().optional().describe('TODO describe inspectionCount field for the OpenInspection MCP integration'), + referralCount: z.number().optional().describe('Inspections where this contact is the tenant buyer_agent (referrals sent).'), }).openapi('Contact'); export const ContactListQuerySchema = z.object({ diff --git a/server/services/contact.service.ts b/server/services/contact.service.ts index 4bc25365a..7bc88e040 100644 --- a/server/services/contact.service.ts +++ b/server/services/contact.service.ts @@ -3,7 +3,7 @@ import { eq, and, like, sql, isNull, inArray, isNotNull } from 'drizzle-orm'; import { contacts } from '../lib/db/schema/contact'; import { inspections } from '../lib/db/schema/inspection'; import { invoices } from '../lib/db/schema/invoice'; -import { inspectionPeople } from '../lib/db/schema/inspection/role-profiles'; +import { inspectionPeople, contactRoleProfiles } from '../lib/db/schema/inspection/role-profiles'; import { Errors } from '../lib/errors'; import { escapeLikePattern } from '../lib/db/like-escape'; import { safeISODate } from '../lib/date'; @@ -16,7 +16,7 @@ export class ContactService { async listContacts(tenantId: string, opts: { type?: 'agent' | 'client'; search?: string; limit: number; offset: number }) { const db = this.getDrizzle(); - const conditions = [eq(contacts.tenantId, tenantId)]; + const conditions = [eq(contacts.tenantId, tenantId), isNull(contacts.archivedAt)]; if (opts.type) conditions.push(eq(contacts.type, opts.type)); if (opts.search) conditions.push(like(contacts.name, `%${escapeLikePattern(opts.search)}%`)); @@ -29,11 +29,18 @@ export class ContactService { // for clients) — a contact could hold >1 role on one inspection, so // count DISTINCT inspection ids. const withCounts = await Promise.all(rows.map(async (c) => { - const res = await db.select({ count: sql`count(distinct ${inspectionPeople.inspectionId})` }) + const res = await db.select({ + count: sql`count(distinct ${inspectionPeople.inspectionId})`, + // Referral = inspections where this contact is the tenant's + // buyer_agent (the metric an inspector reads as "jobs this agent + // sent me"). All-role count stays as inspectionCount. + referralCount: sql`count(distinct case when ${contactRoleProfiles.key} = 'buyer_agent' then ${inspectionPeople.inspectionId} end)`, + }) .from(inspectionPeople) + .leftJoin(contactRoleProfiles, eq(contactRoleProfiles.id, inspectionPeople.roleProfileId)) .where(and(eq(inspectionPeople.tenantId, tenantId), eq(inspectionPeople.contactId, c.id))) .get(); - return { ...c, inspectionCount: res?.count ?? 0 }; + return { ...c, inspectionCount: res?.count ?? 0, referralCount: res?.referralCount ?? 0 }; })); return withCounts.map(c => ({ ...c, createdAt: safeISODate(c.createdAt) })); @@ -157,15 +164,38 @@ export class ContactService { const db = this.getDrizzle(); const existing = await db.select().from(contacts).where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))).get(); if (!existing) throw Errors.NotFound('Contact not found'); - await db.update(contacts).set(data).where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))); - return { ...existing, ...data, createdAt: safeISODate(existing.createdAt) }; + // Agent email is the cross-tenant identity + referral/auto-link key + // (see server/services/agent/referral.ts + signup.ts): editing it can + // re-route report visibility to a different agent and collide with the + // (tenant,email) partial-unique index. Freeze it server-side — the UI + // also renders it read-only, but this is the authoritative guard. To + // change an agent's email, archive the record and add a new one. + const patch = { ...data }; + if (existing.type === 'agent' && 'email' in patch) delete patch.email; + await db.update(contacts).set(patch).where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))); + return { ...existing, ...patch, createdAt: safeISODate(existing.createdAt) }; } async deleteContact(id: string, tenantId: string) { const db = this.getDrizzle(); const existing = await db.select().from(contacts).where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))).get(); if (!existing) throw Errors.NotFound('Contact not found'); - await db.delete(contacts).where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))); + // If nothing references this contact, hard-delete so import mistakes / + // junk rows leave no residue and don't linger against the (tenant,email) + // partial-unique index. Otherwise soft-archive: inspection_people.contact_id + // references this row, so a hard delete would orphan historical + // inspections (and the agent's access to them, which the referral join + // preserves for archived contacts — see the referral-visibility test). + const ref = await db.select({ id: inspectionPeople.id }).from(inspectionPeople) + .where(and(eq(inspectionPeople.tenantId, tenantId), eq(inspectionPeople.contactId, id))) + .get(); + if (!ref) { + await db.delete(contacts).where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))); + return; + } + // Idempotent — re-archiving an archived row is a no-op set. + await db.update(contacts).set({ archivedAt: new Date() }) + .where(and(eq(contacts.id, id), eq(contacts.tenantId, tenantId))); } /** diff --git a/tests/unit/agents/archived-contact-referral-visibility.spec.ts b/tests/unit/agents/archived-contact-referral-visibility.spec.ts new file mode 100644 index 000000000..2e0d0d576 --- /dev/null +++ b/tests/unit/agents/archived-contact-referral-visibility.spec.ts @@ -0,0 +1,59 @@ +import { describe, it, expect, beforeEach, vi } from 'vitest'; +import { eq } from 'drizzle-orm'; +import { ContactService } from '../../../server/services/contact.service'; +import { listReferrals } from '../../../server/services/agent/referral'; +import { createTestDb, setupSchema } from '../db'; +import * as schema from '../../../server/lib/db/schema'; +import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'; + +vi.mock('drizzle-orm/d1', () => ({ drizzle: vi.fn() })); +import { drizzle as mockDrizzle } from 'drizzle-orm/d1'; + +const T = '11111111-1111-1111-1111-1111111111c1'; +const INSP = '99999999-9999-9999-9999-999999999c91'; +const BA_PROFILE = '55555555-5555-5555-5555-5555555555c1'; +const AGENT_CONTACT = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaac1'; +const AGENT_USER = 'dddddddd-dddd-dddd-dddd-ddddddddddc1'; // global agent account (tenant_id NULL) +const LINK = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeec1'; + +async function seed(db: BetterSQLite3Database) { + await db.insert(schema.tenants).values( + { id: T, name: 'A', slug: 'a', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }); + await db.insert(schema.users).values( + { id: AGENT_USER, tenantId: null, email: 'a@x.test', passwordHash: 'x', role: 'agent', createdAt: new Date() }); + await db.insert(schema.contacts).values( + { id: AGENT_CONTACT, tenantId: T, type: 'agent', name: 'Agent A', email: 'a@x.test', createdAt: new Date() }); + await db.insert(schema.contactRoleProfiles).values( + { id: BA_PROFILE, tenantId: T, key: 'buyer_agent', label: "Buyer's Agent", kind: 'agent', isSystem: true, sortOrder: 0, active: true, createdAt: new Date(), updatedAt: new Date() }); + await db.insert(schema.inspections).values( + { id: INSP, tenantId: T, propertyAddress: '1 St', date: '2026-01-01', status: 'completed', price: 0, createdAt: new Date() } as never); + await db.insert(schema.inspectionPeople).values( + { id: 'p1', tenantId: T, inspectionId: INSP, contactId: AGENT_CONTACT, roleProfileId: BA_PROFILE, createdAt: new Date() }); + // Active link scoped to this agent + tenant, pointing at the buyer_agent contact. + await db.insert(schema.agentTenantLinks).values( + { id: LINK, tenantId: T, agentUserId: AGENT_USER, inspectorContactId: AGENT_CONTACT, status: 'active', createdAt: new Date() } as never); +} + +describe('archive preserves agent referral visibility (②)', () => { + let db: BetterSQLite3Database; + beforeEach(async () => { + const fix = createTestDb(); + db = fix.db; + await setupSchema(fix.sqlite); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (mockDrizzle as any).mockReturnValue(db); + await seed(db); + }); + + it('the agent still sees the referral after the contact is archived', async () => { + const before = await listReferrals({} as D1Database, AGENT_USER, { limit: 50 }); + expect(before.map((r) => r.id)).toContain(INSP); + + await new ContactService({} as D1Database).deleteContact(AGENT_CONTACT, T); // archives (referenced) + const contact = await db.select().from(schema.contacts).where(eq(schema.contacts.id, AGENT_CONTACT)).get(); + expect(contact?.archivedAt).toBeTruthy(); // confirm it archived, not hard-deleted + + const after = await listReferrals({} as D1Database, AGENT_USER, { limit: 50 }); + expect(after.map((r) => r.id)).toContain(INSP); // still visible — archive did not revoke access + }); +}); diff --git a/tests/unit/contacts/archive-and-immutability.spec.ts b/tests/unit/contacts/archive-and-immutability.spec.ts new file mode 100644 index 000000000..c1ef3da3a --- /dev/null +++ b/tests/unit/contacts/archive-and-immutability.spec.ts @@ -0,0 +1,99 @@ +import { describe, it, expect, beforeEach, vi } from 'vitest'; +import { eq } from 'drizzle-orm'; +import { ContactService } from '../../../server/services/contact.service'; +import { createTestDb, setupSchema } from '../db'; +import * as schema from '../../../server/lib/db/schema'; +import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'; + +vi.mock('drizzle-orm/d1', () => ({ drizzle: vi.fn() })); +import { drizzle as mockDrizzle } from 'drizzle-orm/d1'; + +const T = '11111111-1111-1111-1111-1111111111f1'; +const INSP = '99999999-9999-9999-9999-999999999991'; +const BA_PROFILE = '55555555-5555-5555-5555-555555555551'; // buyer_agent role profile +const AGENT = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaf1'; // buyer_agent on INSP (a referral) +const AGENT_ZERO = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaf2'; // on no inspection +const CLIENT = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbf1'; + +async function seed(db: BetterSQLite3Database) { + await db.insert(schema.tenants).values( + { id: T, name: 'A', slug: 'a', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }); + await db.insert(schema.contacts).values([ + { id: AGENT, tenantId: T, type: 'agent', name: 'Agent A', email: 'a@x.test', createdAt: new Date() }, + { id: AGENT_ZERO, tenantId: T, type: 'agent', name: 'Agent Z', email: 'z@x.test', createdAt: new Date() }, + { id: CLIENT, tenantId: T, type: 'client', name: 'Client C', email: 'c@x.test', createdAt: new Date() }, + ]); + // Tenant's buyer_agent role profile — referral attribution keys off this + // (inspection_people has NO `role` column; the role is via role_profile_id). + await db.insert(schema.contactRoleProfiles).values( + { id: BA_PROFILE, tenantId: T, key: 'buyer_agent', label: "Buyer's Agent", kind: 'agent', isSystem: true, sortOrder: 0, active: true, createdAt: new Date(), updatedAt: new Date() }); + await db.insert(schema.inspections).values( + { id: INSP, tenantId: T, propertyAddress: '1 St', date: '2026-01-01', status: 'completed', price: 0, createdAt: new Date() } as never); + // AGENT is the buyer_agent on INSP — a real referral link we can prove + // archive does not orphan. + await db.insert(schema.inspectionPeople).values( + { id: 'p1', tenantId: T, inspectionId: INSP, contactId: AGENT, roleProfileId: BA_PROFILE, createdAt: new Date() }); +} + +describe('ContactService archive + agent-email immutability', () => { + let db: BetterSQLite3Database; + let svc: ContactService; + beforeEach(async () => { + const fix = createTestDb(); + db = fix.db; + await setupSchema(fix.sqlite); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (mockDrizzle as any).mockReturnValue(db); + await seed(db); + svc = new ContactService({} as D1Database); + }); + + it('deleteContact soft-archives a REFERENCED contact (row kept, archived_at set)', async () => { + await svc.deleteContact(AGENT, T); // AGENT is on INSP + const row = await db.select().from(schema.contacts).where(eq(schema.contacts.id, AGENT)).get(); + expect(row).toBeTruthy(); + expect(row?.archivedAt).toBeTruthy(); + }); + + it('deleteContact HARD-deletes an UNREFERENCED contact (⑤)', async () => { + await svc.deleteContact(AGENT_ZERO, T); // on no inspection + const row = await db.select().from(schema.contacts).where(eq(schema.contacts.id, AGENT_ZERO)).get(); + expect(row).toBeUndefined(); + }); + + it('archiving does not orphan inspection_people', async () => { + await svc.deleteContact(AGENT, T); + const link = await db.select().from(schema.inspectionPeople) + .where(eq(schema.inspectionPeople.contactId, AGENT)).get(); + expect(link).toBeTruthy(); + }); + + it('listContacts excludes archived rows', async () => { + await svc.deleteContact(AGENT, T); + const rows = await svc.listContacts(T, { limit: 50, offset: 0 }); + expect(rows.map((r) => r.id)).not.toContain(AGENT); + expect(rows.map((r) => r.id)).toContain(CLIENT); + }); + + it('listContacts reports referralCount (buyer_agent) distinct from inspectionCount (①)', async () => { + const rows = await svc.listContacts(T, { type: 'agent', limit: 50, offset: 0 }); + const agent = rows.find((r) => r.id === AGENT)!; + expect(agent.inspectionCount).toBe(1); + expect(agent.referralCount).toBe(1); + const zero = rows.find((r) => r.id === AGENT_ZERO)!; + expect(zero.referralCount).toBe(0); + }); + + it('updateContact ignores an email change on an agent contact', async () => { + await svc.updateContact(AGENT, T, { name: 'Agent A2', email: 'hijack@x.test' }); + const row = await db.select().from(schema.contacts).where(eq(schema.contacts.id, AGENT)).get(); + expect(row?.email).toBe('a@x.test'); // frozen + expect(row?.name).toBe('Agent A2'); // other fields still update + }); + + it('updateContact allows an email change on a client contact', async () => { + await svc.updateContact(CLIENT, T, { email: 'new@x.test' }); + const row = await db.select().from(schema.contacts).where(eq(schema.contacts.id, CLIENT)).get(); + expect(row?.email).toBe('new@x.test'); + }); +}); From 68fc9d116710705d1f5a80073aa7782fd74367d8 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 13:01:27 +0800 Subject: [PATCH 05/15] chore(mcp): regenerate OpenAPI snapshot for team invite cancel/resend routes The two new /api/team/invites/{token}[/resend] routes (Task 1) added MCP-exposed operations; the committed snapshot must reflect them. Missed earlier because Task 1 ran a focused suite; surfaced by the full test:unit in Task 3. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- server/lib/mcp/openapi-snapshot.json | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/server/lib/mcp/openapi-snapshot.json b/server/lib/mcp/openapi-snapshot.json index b7975783c..ed2a24b42 100644 --- a/server/lib/mcp/openapi-snapshot.json +++ b/server/lib/mcp/openapi-snapshot.json @@ -517,6 +517,34 @@ "summary": "Cancel inspection for current tenant", "description": "Auto-generated placeholder for cancelInspection (POST /{id}/cancel, inspections domain). TODO: replace with a real description sourced from the handler." }, + { + "operationId": "cancelTeamInvite", + "method": "DELETE", + "pathTemplate": "/api/team/invites/{token}", + "scopes": [ + "write" + ], + "tag": "team", + "tier": "extended", + "inputSchema": { + "parameters": [ + { + "name": "token", + "in": "path", + "required": true, + "description": "The pending invite token (tenant_invites.id).", + "schema": { + "type": "string", + "format": "uuid", + "description": "The pending invite token (tenant_invites.id)." + } + } + ], + "body": null + }, + "summary": "Cancel a pending seat invite", + "description": "Hard-deletes a pending tenant_invites row that belongs to the caller tenant. 404 when the token is unknown, already accepted, or belongs to another tenant." + }, { "operationId": "changeMyPassword", "method": "POST", @@ -15131,6 +15159,34 @@ "summary": "Request a password reset email", "description": "Triggers a password reset email if the account exists. Always returns 200 even for unknown emails to avoid account enumeration." }, + { + "operationId": "resendTeamInvite", + "method": "POST", + "pathTemplate": "/api/team/invites/{token}/resend", + "scopes": [ + "write" + ], + "tag": "team", + "tier": "extended", + "inputSchema": { + "parameters": [ + { + "name": "token", + "in": "path", + "required": true, + "description": "The pending invite token (tenant_invites.id).", + "schema": { + "type": "string", + "format": "uuid", + "description": "The pending invite token (tenant_invites.id)." + } + } + ], + "body": null + }, + "summary": "Resend a pending seat invite email", + "description": "Re-sends the invitation email for an existing pending tenant_invites row. 404 when the token is unknown, accepted, or cross-tenant." + }, { "operationId": "resetEmailTemplate", "method": "POST", From 32b72823dcf9dc4bd622931aceaf4f6e93d1aa6c Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 13:12:46 +0800 Subject: [PATCH 06/15] test(contacts): guard archive-referral visibility via the email-fallback path --- ...chived-contact-referral-visibility.spec.ts | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/unit/agents/archived-contact-referral-visibility.spec.ts b/tests/unit/agents/archived-contact-referral-visibility.spec.ts index 2e0d0d576..4233fda97 100644 --- a/tests/unit/agents/archived-contact-referral-visibility.spec.ts +++ b/tests/unit/agents/archived-contact-referral-visibility.spec.ts @@ -57,3 +57,71 @@ describe('archive preserves agent referral visibility (②)', () => { expect(after.map((r) => r.id)).toContain(INSP); // still visible — archive did not revoke access }); }); + +// getAgentReferralFilter (server/services/agent/referral.ts) matches a referral +// via EITHER of two independent paths: +// 1. canonical link: inspectionPeople.contactId === agentTenantLinks.inspectorContactId +// — never touches the `contacts` table at all. +// 2. email fallback: contacts.email (joined off inspectionPeople.contactId) +// === the agent user's email — THIS is the path that reads through the +// `contacts` leftJoin and would silently break if that join ever grew an +// `isNull(contacts.archivedAt)` filter. +// The scenario above only exercises path 1 (inspectorContactId is set to the +// buyer_agent contact), so it can't catch a regression on path 2. This second +// scenario deliberately breaks path 1 (inspectorContactId left NULL) so the +// ONLY way the referral is found is via the email-fallback contacts join — +// making it possible for that join to accidentally hide the archived row. +const T2 = '22222222-2222-2222-2222-2222222222c2'; +const INSP2 = '99999999-9999-9999-9999-999999999c92'; +const BA_PROFILE2 = '55555555-5555-5555-5555-5555555555c2'; +const AGENT_CONTACT2 = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaac2'; +const AGENT_USER2 = 'dddddddd-dddd-dddd-dddd-ddddddddddc2'; +const LINK2 = 'eeeeeeee-eeee-eeee-eeee-eeeeeeeeeec2'; + +async function seedEmailFallbackOnly(db: BetterSQLite3Database) { + await db.insert(schema.tenants).values( + { id: T2, name: 'B', slug: 'b', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }); + // Agent user's email intentionally matches the contact's email below — the + // ONLY thing that can associate this referral, since the link's + // inspectorContactId is left NULL (canonical path is unreachable). + await db.insert(schema.users).values( + { id: AGENT_USER2, tenantId: null, email: 'b@x.test', passwordHash: 'x', role: 'agent', createdAt: new Date() }); + await db.insert(schema.contacts).values( + { id: AGENT_CONTACT2, tenantId: T2, type: 'agent', name: 'Agent B', email: 'b@x.test', createdAt: new Date() }); + await db.insert(schema.contactRoleProfiles).values( + { id: BA_PROFILE2, tenantId: T2, key: 'buyer_agent', label: "Buyer's Agent", kind: 'agent', isSystem: true, sortOrder: 0, active: true, createdAt: new Date(), updatedAt: new Date() }); + await db.insert(schema.inspections).values( + { id: INSP2, tenantId: T2, propertyAddress: '2 St', date: '2026-01-02', status: 'completed', price: 0, createdAt: new Date() } as never); + await db.insert(schema.inspectionPeople).values( + { id: 'p2', tenantId: T2, inspectionId: INSP2, contactId: AGENT_CONTACT2, roleProfileId: BA_PROFILE2, createdAt: new Date() }); + // Active link (so the inner join on agentTenantLinks still includes this + // tenant), but inspectorContactId is NULL — the canonical match path can + // never fire, so listReferrals can ONLY find this row via the email + // fallback (contacts.email === agent's email). + await db.insert(schema.agentTenantLinks).values( + { id: LINK2, tenantId: T2, agentUserId: AGENT_USER2, inspectorContactId: null, status: 'active', createdAt: new Date() } as never); +} + +describe('archive preserves agent referral visibility via the email-fallback path', () => { + let db: BetterSQLite3Database; + beforeEach(async () => { + const fix = createTestDb(); + db = fix.db; + await setupSchema(fix.sqlite); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (mockDrizzle as any).mockReturnValue(db); + await seedEmailFallbackOnly(db); + }); + + it('the agent still sees the referral after the contact is archived (email-fallback only)', async () => { + const before = await listReferrals({} as D1Database, AGENT_USER2, { limit: 50 }); + expect(before.map((r) => r.id)).toContain(INSP2); // reachable ONLY via email fallback (no canonical link) + + await new ContactService({} as D1Database).deleteContact(AGENT_CONTACT2, T2); // archives (referenced) + const contact = await db.select().from(schema.contacts).where(eq(schema.contacts.id, AGENT_CONTACT2)).get(); + expect(contact?.archivedAt).toBeTruthy(); // confirm it archived, not hard-deleted + + const after = await listReferrals({} as D1Database, AGENT_USER2, { limit: 50 }); + expect(after.map((r) => r.id)).toContain(INSP2); // still visible via email fallback — archive did not revoke access + }); +}); From c4574b82c883a6408e29aa68e8db35f11ec698a3 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 13:28:07 +0800 Subject: [PATCH 07/15] feat(contacts): Agents CRM directory (referrals), archive confirm, read-only agent email --- app/components/ConfirmDialog.tsx | 9 ++++- app/components/contacts/AgentsTable.tsx | 35 +++++++++++----- app/components/contacts/ContactModal.tsx | 11 ++++-- app/components/contacts/ContactsTable.tsx | 19 +++------ app/components/contacts/contacts-helpers.ts | 9 +---- app/routes/contacts.tsx | 44 +++++++++++++++------ messages/en/contacts.json | 6 +++ 7 files changed, 86 insertions(+), 47 deletions(-) diff --git a/app/components/ConfirmDialog.tsx b/app/components/ConfirmDialog.tsx index 9601671fb..eef323db7 100644 --- a/app/components/ConfirmDialog.tsx +++ b/app/components/ConfirmDialog.tsx @@ -1,16 +1,21 @@ import { Modal } from "@core/shared-ui"; export function ConfirmDialog({ - open, title, message, confirmLabel = "Delete", busy = false, onConfirm, onCancel, + open, title, message, confirmLabel = "Delete", tone = "danger", busy = false, onConfirm, onCancel, }: { open: boolean; title: string; message: string; confirmLabel?: string; + tone?: "danger" | "default"; busy?: boolean; onConfirm: () => void; onCancel: () => void; }) { + const confirmClass = + tone === "danger" + ? "bg-ih-bad-fg text-white hover:opacity-90" + : "bg-ih-primary text-white hover:opacity-90"; return ( {confirmLabel} diff --git a/app/components/contacts/AgentsTable.tsx b/app/components/contacts/AgentsTable.tsx index fb25455eb..72d5067ca 100644 --- a/app/components/contacts/AgentsTable.tsx +++ b/app/components/contacts/AgentsTable.tsx @@ -1,22 +1,37 @@ -import { Card, Pill, EmptyState, Table } from "@core/shared-ui"; +import { Card, EmptyState, Table } from "@core/shared-ui"; import { m } from "~/paraglide/messages"; -import type { Agent } from "./contacts-helpers"; +import type { Contact } from "./contacts-helpers"; -export function AgentsTable({ agentList }: { agentList: Agent[] }) { +export function AgentsTable({ + agentContacts, + onEdit, + onArchive, +}: { + agentContacts: Contact[]; + onEdit: (c: Contact) => void; + onArchive: (c: Contact) => void; +}) { return ( - - rows={agentList} + + rows={agentContacts} getRowKey={(a) => a.id} - empty={} + empty={} columns={[ - { label: m.contacts_type_agent(), cell: (a) => {a.name} }, - { label: m.contacts_agents_col_status(), cell: (a) => {a.status} }, - { label: m.contacts_agents_col_linked(), cell: (a) => {a.linkedAt || "—"} }, + { label: m.contacts_table_col_name(), cell: (a) => {a.name} }, + { label: m.contacts_field_agency(), cell: (a) => {a.agency || "—"} }, + { label: m.contacts_field_email(), cell: (a) => {a.email || "—"} }, + { label: m.contacts_field_phone(), cell: (a) => {a.phone || "—"} }, + { label: m.contacts_agents_col_referrals(), cell: (a) => {a.referralCount ?? 0} }, { label: {m.contacts_table_col_actions()}, align: "right", - cell: () => , + cell: (a) => ( + <> + + + + ), }, ]} /> diff --git a/app/components/contacts/ContactModal.tsx b/app/components/contacts/ContactModal.tsx index e3119a7ca..3b4341a40 100644 --- a/app/components/contacts/ContactModal.tsx +++ b/app/components/contacts/ContactModal.tsx @@ -106,11 +106,16 @@ export function ContactModal({ defaultValue={contact?.email || ""} placeholder={m.contacts_modal_email_placeholder()} aria-invalid={fields.email.errors ? true : undefined} - className="w-full px-3 py-2 rounded-md border border-ih-border bg-ih-bg-card focus:border-ih-primary focus:ring-1 focus:ring-ih-primary outline-none text-sm" + readOnly={isEdit && contact?.type === "agent"} + className={`w-full px-3 py-2 rounded-md border border-ih-border bg-ih-bg-card focus:border-ih-primary focus:ring-1 focus:ring-ih-primary outline-none text-sm ${ + isEdit && contact?.type === "agent" ? "opacity-60 cursor-not-allowed" : "" + }`} /> - {fields.email.errors && ( + {isEdit && contact?.type === "agent" ? ( +

{m.contacts_agent_email_locked_hint()}

+ ) : fields.email.errors ? (

{fields.email.errors[0]}

- )} + ) : null}
diff --git a/app/components/contacts/ContactsTable.tsx b/app/components/contacts/ContactsTable.tsx index af73fafb8..3411b6f99 100644 --- a/app/components/contacts/ContactsTable.tsx +++ b/app/components/contacts/ContactsTable.tsx @@ -1,4 +1,3 @@ -import type { useFetcher } from "react-router"; import { Link } from "react-router"; import { Card, Pill, EmptyState, Table } from "@core/shared-ui"; import { m } from "~/paraglide/messages"; @@ -6,14 +5,12 @@ import type { Contact } from "./contacts-helpers"; export function ContactsTable({ filtered, - setEditContact, - setModalOpen, - deleteFetcher, + onEdit, + onArchive, }: { filtered: Contact[]; - setEditContact: (c: Contact | null) => void; - setModalOpen: (open: boolean) => void; - deleteFetcher: ReturnType; + onEdit: (c: Contact) => void; + onArchive: (c: Contact) => void; }) { return ( @@ -40,12 +37,8 @@ export function ContactsTable({ align: "right", cell: (c) => ( <> - - - - - - + + ), }, diff --git a/app/components/contacts/contacts-helpers.ts b/app/components/contacts/contacts-helpers.ts index 75b973ef8..e9e47303f 100644 --- a/app/components/contacts/contacts-helpers.ts +++ b/app/components/contacts/contacts-helpers.ts @@ -28,14 +28,7 @@ export interface Contact { type: string; agency: string; inspectionCount?: number; -} - -export interface Agent { - id: string; - name: string; - email: string; - status: string; - linkedAt: string; + referralCount?: number; } /** Mirrors `RoleProfileSchema` (server/lib/validations/role-profile.schema.ts). */ diff --git a/app/routes/contacts.tsx b/app/routes/contacts.tsx index ddaab81d6..1a5672df3 100644 --- a/app/routes/contacts.tsx +++ b/app/routes/contacts.tsx @@ -6,13 +6,14 @@ import { requireToken } from "~/lib/session.server"; import { createApi } from "~/lib/api-client.server"; import { makeAddContactSchema } from "~/lib/forms/contacts.schema"; import { PageHeader, TabStrip, Button, Select } from "@core/shared-ui"; -import { inferMappingFromCsv, type Contact, type Agent, type RoleProfile, type MessageTemplateOption } from "~/components/contacts/contacts-helpers"; +import { inferMappingFromCsv, type Contact, type RoleProfile, type MessageTemplateOption } from "~/components/contacts/contacts-helpers"; import { ContactModal } from "~/components/contacts/ContactModal"; import { CsvImportModal } from "~/components/contacts/CsvImportModal"; import { ContactsTable } from "~/components/contacts/ContactsTable"; import { AgentsTable } from "~/components/contacts/AgentsTable"; import { RolesTable } from "~/components/contacts/RolesTable"; import { RoleProfileModal } from "~/components/contacts/RoleProfileModal"; +import { ConfirmDialog } from "~/components/ConfirmDialog"; import { isAdminRole } from "~/lib/access"; import { m } from "~/paraglide/messages"; @@ -42,15 +43,13 @@ export async function loader({ request, context }: Route.LoaderArgs) { const isAdmin = isAdminRole(role); try { - const [contactsRes, agentsRes, rolesRes, emailTemplatesRes, smsTemplatesRes] = await Promise.all([ + const [contactsRes, rolesRes, emailTemplatesRes, smsTemplatesRes] = await Promise.all([ api.contacts.index.$get({ query: filterType === "agent" || filterType === "client" ? { type: filterType } : {} }), - api.agents.links.$get(), api.roleProfiles.index.$get(), api.messageTemplates.index.$get({ query: { channel: "email" } }).catch(() => null), api.messageTemplates.index.$get({ query: { channel: "sms" } }).catch(() => null), ]); const contactsBody = contactsRes.ok ? ((await contactsRes.json()) as Record) : { data: [] }; - const agentsBody = agentsRes.ok ? ((await agentsRes.json()) as Record) : { data: [] }; const rolesBody = rolesRes.ok ? ((await rolesRes.json()) as Record) : { data: [] }; const emailTemplatesBody = emailTemplatesRes && emailTemplatesRes.ok ? ((await emailTemplatesRes.json()) as { data?: MessageTemplateOption[] }) : { data: [] }; @@ -58,14 +57,13 @@ export async function loader({ request, context }: Route.LoaderArgs) { smsTemplatesRes && smsTemplatesRes.ok ? ((await smsTemplatesRes.json()) as { data?: MessageTemplateOption[] }) : { data: [] }; return { contacts: (contactsBody.data ?? []) as Contact[], - agents: (agentsBody.data ?? []) as Agent[], roleProfiles: (rolesBody.data ?? []) as RoleProfile[], messageTemplates: [...(emailTemplatesBody.data ?? []), ...(smsTemplatesBody.data ?? [])] as MessageTemplateOption[], filterType, isAdmin, }; } catch { - return { contacts: [], agents: [], roleProfiles: [], messageTemplates: [], filterType: "", isAdmin }; + return { contacts: [], roleProfiles: [], messageTemplates: [], filterType: "", isAdmin }; } } @@ -170,14 +168,13 @@ export async function action({ request, context }: Route.ActionArgs) { } export default function ContactsPage() { - const { contacts, agents, roleProfiles, messageTemplates, filterType, isAdmin } = useLoaderData(); + const { contacts, roleProfiles, messageTemplates, filterType, isAdmin } = useLoaderData(); const TABS = [ { id: "contacts", label: m.contacts_label_contacts() }, { id: "agents", label: m.contacts_label_agents() }, ...(isAdmin ? [{ id: "roles", label: m.contacts_label_roles() }] : []), ]; const contactList = contacts as Contact[]; - const agentList = agents as Agent[]; const roleProfileList = roleProfiles as RoleProfile[]; const templateList = messageTemplates as MessageTemplateOption[]; const [activeTab, setActiveTab] = useState("contacts"); @@ -187,7 +184,21 @@ export default function ContactsPage() { const [roleModalOpen, setRoleModalOpen] = useState(false); const [editRole, setEditRole] = useState(null); const [typeFilter, setTypeFilter] = useState(filterType || ""); - const deleteFetcher = useFetcher(); + const [pendingArchive, setPendingArchive] = useState(null); + const archiveFetcher = useFetcher<{ ok?: boolean }>(); + + const agentContacts = contactList.filter((c) => c.type === "agent"); + + const openEdit = (c: Contact) => { setEditContact(c); setModalOpen(true); }; + const confirmArchive = () => { + if (pendingArchive) { + archiveFetcher.submit( + { intent: "delete", id: pendingArchive.id }, + { method: "post" }, + ); + setPendingArchive(null); + } + }; const filtered = typeFilter ? contactList.filter((c) => c.type === typeFilter) @@ -228,11 +239,11 @@ export default function ContactsPage() { {activeTab === "contacts" && ( - + )} {activeTab === "agents" && ( - + )} {activeTab === "roles" && isAdmin && ( @@ -253,6 +264,17 @@ export default function ContactsPage() { templates={templateList} /> )} + + setPendingArchive(null)} + />
); } diff --git a/messages/en/contacts.json b/messages/en/contacts.json index 80cd691c0..12e4e5412 100644 --- a/messages/en/contacts.json +++ b/messages/en/contacts.json @@ -33,6 +33,12 @@ "contacts_agents_col_status": "Status", "contacts_agents_col_linked": "Linked", "contacts_agents_revoke": "Revoke", + "contacts_action_archive": "Archive", + "contacts_agents_col_referrals": "Referrals", + "contacts_agent_email_locked_hint": "An agent's email is their account key across companies, so it can't be changed here. To fix a typo or move to a new address, archive this agent and add a new one (report links already sent still work).", + "contacts_agents_empty_desc": "Agents you add or import appear here. Grant report access per inspection from the People panel.", + "contacts_archive_title": "Archive this contact?", + "contacts_archive_confirm": "Removes them from your list. Their inspections and any report links they were sent are unaffected.", "contacts_detail_archived": "Archived", "contacts_detail_back": "Back to Contacts", "contacts_detail_info_heading": "Contact info", From b573b10589809b6583b1539b2e339c344630454f Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 14:01:10 +0800 Subject: [PATCH 08/15] refactor: remove dormant M20 IdentitySwitcher, keep GDPR account routes --- app/routes.ts | 1 - app/routes/resources/identities.tsx | 46 -------- server/api/identity.ts | 97 +--------------- server/lib/db/schema/identity-links.ts | 29 ----- server/lib/db/schema/index.ts | 3 - server/lib/mcp/openapi-snapshot.json | 74 ------------- server/lib/middleware/di.ts | 4 - server/services/identity.service.ts | 102 ----------------- server/types/hono.ts | 1 - tests/unit/tenancy/identity-service.spec.ts | 117 -------------------- 10 files changed, 4 insertions(+), 470 deletions(-) delete mode 100644 app/routes/resources/identities.tsx delete mode 100644 server/lib/db/schema/identity-links.ts delete mode 100644 server/services/identity.service.ts delete mode 100644 tests/unit/tenancy/identity-service.spec.ts diff --git a/app/routes.ts b/app/routes.ts index de84da686..9b5e225a9 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -89,7 +89,6 @@ export default [ route("resources/repair-items", "routes/resources/repair-items.tsx"), route("resources/cost-items", "routes/resources/cost-items.tsx"), route("resources/cost-export", "routes/resources/cost-export.tsx"), - route("resources/identities", "routes/resources/identities.tsx"), route("resources/inspection-prefs", "routes/resources/inspection-prefs.tsx"), route("resources/inspection-settings-sheet", "routes/resources/inspection-settings-sheet.tsx"), route("resources/inspection-media", "routes/resources/inspection-media.tsx"), diff --git a/app/routes/resources/identities.tsx b/app/routes/resources/identities.tsx deleted file mode 100644 index 889b44075..000000000 --- a/app/routes/resources/identities.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/** - * C-12 — BFF resource route for identity switcher. - * - * loader: GET /api/identities — list linked identities for the caller - * action: POST /api/identities/switch — switch active identity (sets cookie, returns redirectUrl) - */ -import type { Route } from "./+types/identities"; -import { getToken } from "~/lib/session.server"; -import { createApi } from "~/lib/api-client.server"; - -export async function loader({ request, context }: Route.LoaderArgs) { - const token = await getToken(context, request); - if (!token) return { identities: [] as unknown[] }; - const api = createApi(context, { token }); - try { - const res = await api.identity.index.$get( - {}, - { headers: { "x-token-relay": "1" } }, - ); - if (!res.ok) return { identities: [] as unknown[] }; - const json = await res.json() as { data?: { identities?: unknown[] } }; - return { identities: json?.data?.identities ?? [] }; - } catch { - return { identities: [] as unknown[] }; - } -} - -export async function action({ request, context }: Route.ActionArgs) { - const token = await getToken(context, request); - if (!token) return { ok: false as const, redirectUrl: null }; - const api = createApi(context, { token }); - const form = await request.formData(); - const linkedUserId = String(form.get("linkedUserId") ?? ""); - if (!linkedUserId) return { ok: false as const, redirectUrl: null }; - try { - const res = await api.identity.switch.$post( - { json: { linkedUserId } }, - { headers: { "x-token-relay": "1" } }, - ); - if (!res.ok) return { ok: false as const, redirectUrl: null }; - const json = await res.json() as { data?: { redirectUrl?: string } }; - return { ok: true as const, redirectUrl: json?.data?.redirectUrl ?? "/inspections" }; - } catch { - return { ok: false as const, redirectUrl: null }; - } -} diff --git a/server/api/identity.ts b/server/api/identity.ts index dc1ddb3ff..ca9873eb1 100644 --- a/server/api/identity.ts +++ b/server/api/identity.ts @@ -1,21 +1,14 @@ /** - * Design System 0520 subsystem E phase 4 — IdentitySwitcher routes (M20). + * GDPR/CCPA account export + soft-delete routes. * - * GET /api/identities — list linked identities for the caller - * POST /api/identities/switch — issue a new JWT for a linked identity - * and replace the session cookie - * POST /api/identities/link — admin-only: link the caller to another - * user (by email) so it appears in the - * switcher menu - * - * Switch and link write to audit_logs via AuditLogService when available. + * POST /api/identity/account/export — export the caller's account data + * POST /api/identity/account/delete — soft-delete the caller's account */ -import { createRoute, z } from '@hono/zod-openapi'; +import { createRoute } from '@hono/zod-openapi'; import { drizzle } from 'drizzle-orm/d1'; import { createApiRouter } from '../lib/openapi-router'; import { HonoConfig } from '../types/hono'; import type { Context } from 'hono'; -import { setCookie } from 'hono/cookie'; import { Errors } from '../lib/errors'; import { withMcpMetadata } from '../lib/route-metadata-standards'; import { @@ -31,53 +24,6 @@ function getCallerUserId(c: Context): string { return sub; } -const listRoute = createRoute(withMcpMetadata({ - method: 'get', - path: '/', - operationId: 'listMyLinkedIdentities', - tags: ['identity'], - summary: 'List linked identities for the caller', - description: 'Returns all identity seats linked to the caller, including the primary identity. Used by the identity switcher menu in the dashboard.', - responses: { 200: { description: 'ok' } }, -}, { scopes: ['read'], tier: 'extended' })); - -const switchRoute = createRoute(withMcpMetadata({ - method: 'post', - path: '/switch', - operationId: 'switchActiveIdentity', - tags: ['identity'], - summary: 'Switch active identity to linked seat', - description: 'Issues a new JWT for the specified linked identity and replaces the session cookie. Caller must be linked to the target identity already.', - request: { - body: { content: { 'application/json': { schema: z.object({ - linkedUserId: z.string().min(1).describe('UUID of the linked identity to switch into; must be one of the caller\'s linked seats.'), - }).describe('TODO describe schema field for the OpenInspection MCP integration') } } }, - }, - responses: { - 200: { description: 'ok' }, - 403: { description: 'forbidden — not linked' }, - 404: { description: 'linked user gone' }, - }, -}, { scopes: ['write'], tier: 'extended' })); - -const linkRoute = createRoute(withMcpMetadata({ - method: 'post', - path: '/link', - operationId: 'linkIdentityByEmail', - tags: ['identity'], - summary: 'Link another identity by email', - description: 'Admin-only: links the caller\'s primary user record to another existing user (looked up by email) so the second seat becomes available in the switcher menu.', - request: { - body: { content: { 'application/json': { schema: z.object({ - targetEmail: z.string().email().describe('Email address of the other existing user account to link into the caller\'s identity set.'), - }).describe('TODO describe schema field for the OpenInspection MCP integration') } } }, - }, - responses: { - 200: { description: 'ok' }, - 404: { description: 'target user not found' }, - }, -}, { scopes: ['admin'], tier: 'extended' })); - // ─── Account export + soft delete ─────────────────────────────────────────── const accountExportRoute = createRoute(withMcpMetadata({ method: 'post', @@ -114,41 +60,6 @@ const accountDeleteRoute = createRoute(withMcpMetadata({ }, { scopes: ['write'], tier: 'extended' })); const identityRoutes = createApiRouter() - .openapi(listRoute, async (c) => { - const items = await c.var.services.identity.list(getCallerUserId(c)); - return c.json({ success: true as const, data: { identities: items } }, 200); - }) - .openapi(switchRoute, async (c) => { - const primaryUserId = getCallerUserId(c); - const { linkedUserId } = c.req.valid('json'); - const keyring = await c.var.keyringPromise; - if (!keyring) throw Errors.Internal('JWT keyring not initialised'); - - const out = await c.var.services.identity.switchTo(primaryUserId, linkedUserId, { keyring }); - if (out.kind === 'forbidden') throw Errors.Forbidden('Not linked to that identity'); - if (out.kind === 'not_found') throw Errors.NotFound('Linked user no longer exists'); - - // Replace the session cookie — same attributes as login per CLAUDE.md - // JWT/Auth Security Rules: __Host- prefix, httpOnly, secure, Strict. - setCookie(c, '__Host-inspector_token', out.newToken, { - httpOnly: true, secure: true, sameSite: 'Strict', path: '/', - }); - - return c.json({ success: true as const, data: { redirectUrl: out.redirectUrl } }, 200); - }) - .openapi(linkRoute, async (c) => { - const primaryUserId = getCallerUserId(c); - const { targetEmail } = c.req.valid('json'); - try { - const out = await c.var.services.identity.link({ primaryUserId, targetEmail }); - return c.json({ success: true as const, data: out }, 200); - } catch (e) { - if (e instanceof Error && /target user not found/i.test(e.message)) { - throw Errors.NotFound('Target user not found'); - } - throw e; - } - }) .openapi(accountExportRoute, async (c) => { const userId = getCallerUserId(c); const db = drizzle(c.env.DB); diff --git a/server/lib/db/schema/identity-links.ts b/server/lib/db/schema/identity-links.ts deleted file mode 100644 index 499b1d919..000000000 --- a/server/lib/db/schema/identity-links.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Design System 0520 subsystem E phase 4 — IdentitySwitcher (M20). - * - * One row per (primary user → linked seat) association. The - * IdentityService.list builds the switcher menu from this table; the - * switch route copies the linked seat's tenantId + role into a fresh - * JWT, then sets the canonical cookie so subsequent requests are - * scoped to that workspace. - * - * `linkedRole` mirrors the workspace role of the linked user - * (owner / admin / inspector / agent). `linkedDisplayName` snapshots the - * tenant + display name at link-time so the menu can render without a - * per-row join. - */ -import { sqliteTable, text, integer, index, uniqueIndex } from 'drizzle-orm/sqlite-core'; -import { sql } from 'drizzle-orm'; - -export const userIdentityLinks = sqliteTable('user_identity_links', { - id: text('id').primaryKey(), - primaryUserId: text('primary_user_id').notNull(), - linkedUserId: text('linked_user_id').notNull(), - linkedTenantId: text('linked_tenant_id').notNull(), - linkedRole: text('linked_role').notNull(), - linkedDisplayName: text('linked_display_name').notNull(), - createdAt: integer('created_at', { mode: 'timestamp_ms' }).notNull().default(sql`(unixepoch() * 1000)`), -}, (t) => [ - index('idx_user_identity_links_primary').on(t.primaryUserId), - uniqueIndex('uq_user_identity_links_primary_linked').on(t.primaryUserId, t.linkedUserId), -]); diff --git a/server/lib/db/schema/index.ts b/server/lib/db/schema/index.ts index 6bdc3cd0c..3d2be6dee 100644 --- a/server/lib/db/schema/index.ts +++ b/server/lib/db/schema/index.ts @@ -63,9 +63,6 @@ export { inspectionUnits } from './units'; export { observerLinks } from './observer'; // Design System 0520 subsystem D — ReportVersions (snapshot-on-publish) export { reportVersions } from './report-versions'; -// Design System 0520 subsystem E — IdentitySwitcher links -export { userIdentityLinks } from './identity-links'; - export { inspectionAccessTokens } from './portal-access'; export { contactRoleProfiles, inspectionPeople } from './inspection/role-profiles'; diff --git a/server/lib/mcp/openapi-snapshot.json b/server/lib/mcp/openapi-snapshot.json index ed2a24b42..5f24c158e 100644 --- a/server/lib/mcp/openapi-snapshot.json +++ b/server/lib/mcp/openapi-snapshot.json @@ -8572,35 +8572,6 @@ "summary": "Leaderboard agent for current tenant", "description": "Auto-generated placeholder for leaderboardAgent (GET /leaderboard, agents domain). TODO: replace with a real description sourced from the handler." }, - { - "operationId": "linkIdentityByEmail", - "method": "POST", - "pathTemplate": "/api/identities/link", - "scopes": [ - "admin" - ], - "tag": "identity", - "tier": "extended", - "inputSchema": { - "parameters": [], - "body": { - "type": "object", - "properties": { - "targetEmail": { - "type": "string", - "format": "email", - "description": "Email address of the other existing user account to link into the caller's identity set." - } - }, - "required": [ - "targetEmail" - ], - "description": "TODO describe schema field for the OpenInspection MCP integration" - } - }, - "summary": "Link another identity by email", - "description": "Admin-only: links the caller's primary user record to another existing user (looked up by email) so the second seat becomes available in the switcher menu." - }, { "operationId": "listAgentInspectors", "method": "GET", @@ -10317,22 +10288,6 @@ "summary": "List metrics for current tenant", "description": "Auto-generated placeholder for listMetrics (GET /, metrics domain). TODO: replace with a real description sourced from the handler." }, - { - "operationId": "listMyLinkedIdentities", - "method": "GET", - "pathTemplate": "/api/identities", - "scopes": [ - "read" - ], - "tag": "identity", - "tier": "extended", - "inputSchema": { - "parameters": [], - "body": null - }, - "summary": "List linked identities for the caller", - "description": "Returns all identity seats linked to the caller, including the primary identity. Used by the identity switcher menu in the dashboard." - }, { "operationId": "listNotifications", "method": "GET", @@ -15967,35 +15922,6 @@ "summary": "Submit report for review", "description": "Transitions reportStatus from in_progress → submitted. Requires inspection.status === completed." }, - { - "operationId": "switchActiveIdentity", - "method": "POST", - "pathTemplate": "/api/identities/switch", - "scopes": [ - "write" - ], - "tag": "identity", - "tier": "extended", - "inputSchema": { - "parameters": [], - "body": { - "type": "object", - "properties": { - "linkedUserId": { - "type": "string", - "minLength": 1, - "description": "UUID of the linked identity to switch into; must be one of the caller's linked seats." - } - }, - "required": [ - "linkedUserId" - ], - "description": "TODO describe schema field for the OpenInspection MCP integration" - } - }, - "summary": "Switch active identity to linked seat", - "description": "Issues a new JWT for the specified linked identity and replaces the session cookie. Caller must be linked to the target identity already." - }, { "operationId": "switchInspectionRatingSystem", "method": "POST", diff --git a/server/lib/middleware/di.ts b/server/lib/middleware/di.ts index 5e62eadef..ee64b917f 100644 --- a/server/lib/middleware/di.ts +++ b/server/lib/middleware/di.ts @@ -53,7 +53,6 @@ import { IcsService } from '../../services/ics.service'; import { AgentService } from '../../services/agent.service'; import { ConciergeService } from '../../services/concierge.service'; import { QBOService } from '../../services/qbo.service'; -import { IdentityService } from '../../services/identity.service'; import { IntegrationsService } from '../../services/integrations.service'; import { AnalyticsService } from '../../services/analytics.service'; import { RepairRequestService } from '../../services/repair-request.service'; @@ -395,9 +394,6 @@ export async function diMiddleware(c: Context, next: Next) { case 'reportVersion': target.reportVersion = new ReportVersionService(c.env.DB, c.env.KEY_ENCRYPTION_SECRET || c.env.JWT_SECRET); break; - case 'identity': - target.identity = new IdentityService(c.env.DB); - break; case 'integrations': target.integrations = new IntegrationsService(c.env.DB, c.env); break; diff --git a/server/services/identity.service.ts b/server/services/identity.service.ts deleted file mode 100644 index 5bb9a0e41..000000000 --- a/server/services/identity.service.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Design System 0520 subsystem E phase 4 — IdentitySwitcher (M20). - * - * Allows a user to be the "primary" identity for one or more workspace - * seats elsewhere (a property manager who's also an inspector at a - * sibling tenant; an office staffer who admins multiple branches). - * The switcher reads `user_identity_links` and on switch issues a - * fresh ES256 JWT for the target user via the existing keyring. - * - * Three surfaces: - * list(primary) — rows powering the dropdown. - * switchTo(primary, linked) — verify link → sign JWT → return token. - * link({ primary, email }) — admin-only seed for the link table. - * - * The `link` method snapshots role + tenantId + display name at link- - * time so the dropdown can render without per-row joins. - */ -import { drizzle } from 'drizzle-orm/d1'; -import { eq, and, isNull } from 'drizzle-orm'; -import { userIdentityLinks } from '../lib/db/schema/identity-links'; -import { users } from '../lib/db/schema'; -import { signJwt } from '../lib/jwt-keyring'; -import type { JwtKeyring } from '../lib/jwt-keyring'; - -export interface IdentityLinkRow { - id: string; - primaryUserId: string; - linkedUserId: string; - linkedTenantId: string; - linkedRole: string; - linkedDisplayName: string; - createdAt: Date; -} - -export type SwitchResult = - | { kind: 'ok'; newToken: string; redirectUrl: string } - | { kind: 'forbidden' } - | { kind: 'not_found' }; - -export class IdentityService { - constructor(private db: D1Database) {} - - private getDrizzle() { - return drizzle(this.db); - } - - async list(primaryUserId: string): Promise { - return await this.getDrizzle().select().from(userIdentityLinks) - .where(eq(userIdentityLinks.primaryUserId, primaryUserId)) - .all(); - } - - async switchTo( - primaryUserId: string, - linkedUserId: string, - ctx: { keyring: JwtKeyring }, - ): Promise { - const db = this.getDrizzle(); - const link = await db.select().from(userIdentityLinks) - .where(and( - eq(userIdentityLinks.primaryUserId, primaryUserId), - eq(userIdentityLinks.linkedUserId, linkedUserId), - )) - .get(); - if (!link) return { kind: 'forbidden' }; - - // Excludes soft-deleted (removed member) rows — switching mints a - // fresh JWT without a password check, so it must honor the same - // active-user gate as login. - const linkedUser = await db.select().from(users) - .where(and(eq(users.id, linkedUserId), isNull(users.deletedAt))).get(); - if (!linkedUser) return { kind: 'not_found' }; - - const newToken = await signJwt({ - sub: linkedUser.id, - email: linkedUser.email, - 'custom:tenantId': linkedUser.tenantId, - 'custom:userRole': linkedUser.role, - role: linkedUser.role, - }, ctx.keyring); - - return { kind: 'ok', newToken, redirectUrl: '/inspections' }; - } - - async link({ primaryUserId, targetEmail }: { primaryUserId: string; targetEmail: string }): Promise<{ id: string }> { - const db = this.getDrizzle(); - const target = await db.select().from(users).where(eq(users.email, targetEmail)).get(); - if (!target) throw new Error('target user not found'); - - const id = crypto.randomUUID(); - await db.insert(userIdentityLinks).values({ - id, - primaryUserId, - linkedUserId: target.id, - linkedTenantId: target.tenantId ?? '', - linkedRole: target.role, - linkedDisplayName: target.name ?? target.email, - createdAt: new Date(), - }); - return { id }; - } -} diff --git a/server/types/hono.ts b/server/types/hono.ts index e7d131504..eeaa16ed2 100644 --- a/server/types/hono.ts +++ b/server/types/hono.ts @@ -327,7 +327,6 @@ export interface AppServices { unitSwitch: import('../services/unit-switch.service').UnitSwitchService; observerLink: import('../services/observer-link.service').ObserverLinkService; reportVersion: import('../services/report-version.service').ReportVersionService; - identity: import('../services/identity.service').IdentityService; integrations: import('../services/integrations.service').IntegrationsService; analytics: import('../services/analytics.service').AnalyticsService; repairRequest: import('../services/repair-request.service').RepairRequestService; diff --git a/tests/unit/tenancy/identity-service.spec.ts b/tests/unit/tenancy/identity-service.spec.ts deleted file mode 100644 index 769970a03..000000000 --- a/tests/unit/tenancy/identity-service.spec.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Design System 0520 subsystem E P4.1 — IdentityService TDD. - * - * Three behaviours under test (TDD-first): - * • list(primary) returns the snapshot rows associated with the - * primary user. - * • switchTo(primary, linked) issues a fresh ES256 JWT for the - * linked user, ONLY when the link row exists. - * • link({ primary, targetEmail }) inserts a row using the snapshot - * of the target's role + display name at link-time. - */ -import { describe, it, expect, beforeEach, vi } from 'vitest'; -import { eq } from 'drizzle-orm'; -import { IdentityService } from '../../../server/services/identity.service'; -import { createTestDb, setupSchema } from '../db'; -import * as schema from '../../../server/lib/db/schema'; -import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3'; - -vi.mock('drizzle-orm/d1', () => ({ drizzle: vi.fn() })); -import { drizzle as mockDrizzle } from 'drizzle-orm/d1'; - -// Stub signJwt so the test doesn't need a real ES256 keyring. The -// service module imports it from jwt-keyring; we replace the function -// with a deterministic stub that echoes the payload as base64. -vi.mock('../../../server/lib/jwt-keyring', () => ({ - signJwt: vi.fn(async (payload: Record) => - `eyJ${Buffer.from(JSON.stringify(payload)).toString('base64url')}.test.sig`, - ), -})); - -const TENANT_A = '11111111-1111-1111-1111-1111111111e1'; -const TENANT_B = '22222222-2222-2222-2222-2222222222e2'; -const PRIMARY = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaae0'; -const LINKED = 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbe0'; -const STRANGER = 'cccccccc-cccc-cccc-cccc-cccccccccce0'; - -async function seed(testDb: BetterSQLite3Database) { - await testDb.insert(schema.tenants).values([ - { id: TENANT_A, name: 'Acme A', slug: 'acme-a', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }, - { id: TENANT_B, name: 'Acme B', slug: 'acme-b', status: 'active', deploymentMode: 'shared', tier: 'free', createdAt: new Date() }, - ]); - await testDb.insert(schema.users).values([ - { id: PRIMARY, tenantId: TENANT_A, email: 'u@a.test', passwordHash: 'x', role: 'admin', createdAt: new Date() }, - { id: LINKED, tenantId: TENANT_B, email: 'u@b.test', passwordHash: 'x', role: 'inspector', createdAt: new Date() }, - { id: STRANGER, tenantId: TENANT_B, email: 's@b.test', passwordHash: 'x', role: 'inspector', createdAt: new Date() }, - ]); -} - -describe('IdentityService (subsystem E P4.1)', () => { - let testDb: BetterSQLite3Database; - let svc: IdentityService; - - beforeEach(async () => { - const fix = createTestDb(); - testDb = fix.db; - await setupSchema(fix.sqlite); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (mockDrizzle as any).mockReturnValue(testDb); - await seed(testDb); - svc = new IdentityService({} as D1Database); - }); - - it('list returns empty before any link', async () => { - const out = await svc.list(PRIMARY); - expect(out).toEqual([]); - }); - - it('link snapshots role + tenantId + display name into the row', async () => { - const created = await svc.link({ primaryUserId: PRIMARY, targetEmail: 'u@b.test' }); - expect(created.id).toMatch(/^[0-9a-f-]{36}$/); - - const rows = await svc.list(PRIMARY); - expect(rows).toHaveLength(1); - expect(rows[0]).toMatchObject({ - primaryUserId: PRIMARY, - linkedUserId: LINKED, - linkedTenantId: TENANT_B, - linkedRole: 'inspector', - linkedDisplayName: 'u@b.test', - }); - }); - - it('link throws when target email is unknown', async () => { - await expect(svc.link({ primaryUserId: PRIMARY, targetEmail: 'no@one' })) - .rejects.toThrow(/target user not found/i); - }); - - it('switchTo returns ok + new ES256-formatted token when link exists', async () => { - await svc.link({ primaryUserId: PRIMARY, targetEmail: 'u@b.test' }); - const out = await svc.switchTo(PRIMARY, LINKED, { keyring: {} as never }); - expect(out.kind).toBe('ok'); - if (out.kind === 'ok') { - expect(out.newToken).toMatch(/^eyJ/); - expect(out.redirectUrl).toBe('/inspections'); - } - }); - - it('switchTo returns forbidden when no link exists for that target', async () => { - const out = await svc.switchTo(PRIMARY, STRANGER, { keyring: {} as never }); - expect(out.kind).toBe('forbidden'); - }); - - it('switchTo returns forbidden when caller and target are unrelated entirely', async () => { - const out = await svc.switchTo(PRIMARY, 'no-such-user', { keyring: {} as never }); - expect(out.kind).toBe('forbidden'); - }); - - it('list is scoped per primary user (no cross-user leak)', async () => { - await svc.link({ primaryUserId: PRIMARY, targetEmail: 'u@b.test' }); - const other = await svc.list(STRANGER); - expect(other).toEqual([]); - - const primaryRows = await testDb.select().from(schema.userIdentityLinks) - .where(eq(schema.userIdentityLinks.primaryUserId, PRIMARY)).all(); - expect(primaryRows).toHaveLength(1); - }); -}); From 16047effb12ac830220bf1ea15022c6b77a60418 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 14:31:00 +0800 Subject: [PATCH 09/15] chore(test): purge stale M20 IdentitySwitcher references from fixtures + e2e --- tests/e2e/subsystem-e-flows.spec.ts | 13 ------------- tests/seed-fixtures.ts | 14 +++----------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/e2e/subsystem-e-flows.spec.ts b/tests/e2e/subsystem-e-flows.spec.ts index 4d3837b08..7452e4603 100644 --- a/tests/e2e/subsystem-e-flows.spec.ts +++ b/tests/e2e/subsystem-e-flows.spec.ts @@ -7,7 +7,6 @@ * * tests/unit/preflight.spec.ts (9 tests, GREEN) * tests/unit/csv-export.spec.ts (7 tests, GREEN) - * tests/unit/identity-service.spec.ts (7 tests, GREEN) * tests/unit/analytics.spec.ts (8 tests, GREEN) * * Unskip once the seed harness lands in tests/global-setup.ts. @@ -43,18 +42,6 @@ test.skip('P3 — CSV Export downloads visible inspections', async ({ page }) => expect(download.suggestedFilename()).toMatch(/^inspections-\d{4}-\d{2}-\d{2}\.csv$/); }); -test.skip('P4 — user with linked identity can switch into the linked tenant', async ({ page }) => { - await page.goto('/login'); - await page.fill('input[name=email]', 'multi-tenant-user@seed.test'); - await page.fill('input[name=password]', 'seedpassword'); - await page.click('button[type=submit]'); - - await page.click('[aria-label="User menu"]'); - await expect(page.locator('text=Switch identity')).toBeVisible(); - await page.click('text=branch-b@seed.test'); - await page.waitForURL('**/inspections'); -}); - test.skip('P6 — IntegrationGrid renders 6 cards with correct connected state', async ({ page }) => { await page.goto('/settings/integrations-grid'); for (const name of ['QuickBooks Online', 'Stripe Connect', 'Google Calendar', diff --git a/tests/seed-fixtures.ts b/tests/seed-fixtures.ts index 36e613032..cbfd796ce 100644 --- a/tests/seed-fixtures.ts +++ b/tests/seed-fixtures.ts @@ -46,7 +46,7 @@ export function seedFixtures(appDir: string): void { const cwd = appDir; const now = new Date().toISOString(); - // Two tenants so the IdentitySwitcher (E P4) has somewhere to land. + // Two tenants — Tenant A is the default; Tenant B backs the branch-B fixture user below. d1(`INSERT OR REPLACE INTO tenants (id, name, slug, status, deployment_mode, tier, max_users, created_at) VALUES ('${TENANT_A_ID}', 'Seed Tenant A', 'seed-a', 'active', 'shared', 'free', 5, '${now}')`, cwd); d1(`INSERT OR REPLACE INTO tenants (id, name, slug, status, deployment_mode, tier, max_users, created_at) @@ -71,7 +71,7 @@ export function seedFixtures(appDir: string): void { VALUES ('55555555-5555-5555-5555-555555555cc1', '00000000-0000-0000-0000-000000000cc1', '${ADMIN_FULL_EMAIL}', '${SEED_PASSWORD_HASH}', 'At-Cap Admin', 'admin', '${now}')`, cwd); - // Multi-tenant user for IdentitySwitcher E P4 E2E. + // Multi-tenant fixture users (tenant A primary + tenant B branch). d1(`INSERT OR REPLACE INTO users (id, tenant_id, email, password_hash, name, role, created_at) VALUES ('66666666-6666-6666-6666-666666666aa1', '${TENANT_A_ID}', '${MULTI_EMAIL}', '${SEED_PASSWORD_HASH}', 'Multi-Tenant Primary', 'admin', '${now}')`, cwd); @@ -79,14 +79,6 @@ export function seedFixtures(appDir: string): void { VALUES ('77777777-7777-7777-7777-777777777bb1', '${TENANT_B_ID}', '${BRANCH_B_EMAIL}', '${SEED_PASSWORD_HASH}', 'Branch B Identity', 'admin', '${now}')`, cwd); - // Identity link between the two so the switcher dropdown surfaces it. - d1(`INSERT OR REPLACE INTO user_identity_links - (id, primary_user_id, linked_user_id, linked_tenant_id, linked_role, linked_display_name, created_at) - VALUES ('88888888-8888-8888-8888-888888888aa1', - '66666666-6666-6666-6666-666666666aa1', - '77777777-7777-7777-7777-777777777bb1', - '${TENANT_B_ID}', 'admin', 'branch-b@seed.test', '${now}')`, cwd); - // Inspections — empty / half-done / team / delivered / republished // referenced by the E2E spec stubs. Templates intentionally NULL so // the editor falls back to the seed template path. @@ -104,7 +96,7 @@ export function seedFixtures(appDir: string): void { d1(inspectionRow('seed-delivered-inspection', '5 Delivered Ln', 'delivered'), cwd); d1(inspectionRow('seed-republished-inspection', '6 Republished Ct', 'delivered'), cwd); - console.info('[seed-fixtures] Seeded tenants + 7 users + 6 inspections + 1 identity link.'); + console.info('[seed-fixtures] Seeded tenants + 7 users + 6 inspections.'); } export const SEED_PASSWORD = 'seedpassword'; From 9f5de4d78d9150445d5dc057978a179c4f5aa895 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 14:57:48 +0800 Subject: [PATCH 10/15] chore: zero out knip dead-code baseline (resolve final 5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PillTone (hub-blocks.ts) + CreateInspectionFromWizardInput (wizard.schema.ts): genuinely used via inline import type refs that knip cannot trace — kept exported, marked @public (knip honors the tag). The plan's drop-export/static-import approach was wrong: dropping PillTone's export broke inspection-hub.tsx, and static imports pushed two already-capped service files over the file-size ratchet. - TotpRegenerateSchema alias collapsed into TotpDisableSchema (identical schema). - Server formatDate/formatTime made statically visible to knip via a void[] ref in the parity test (used dynamically as (srvFmt as any)[fn]). Baseline is now []. No behavior change; no file-size/OpenAPI-snapshot impact. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- app/lib/hub-blocks.ts | 6 +++++- scripts/knip-baseline.json | 8 +------- server/api/auth/totp.ts | 3 +-- server/lib/validations/auth.schema.ts | 2 -- server/lib/validations/wizard.schema.ts | 5 +++++ tests/unit/platform/format-parity.spec.ts | 6 ++++++ 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/lib/hub-blocks.ts b/app/lib/hub-blocks.ts index 2fbd829a3..56251c180 100644 --- a/app/lib/hub-blocks.ts +++ b/app/lib/hub-blocks.ts @@ -15,7 +15,11 @@ import { INSPECTION_STATUS, isReportPublished } from '~/lib/status'; import { formatCurrency } from '~/lib/format'; import { m } from '~/paraglide/messages'; -/** Pill tone union — kept in sync with packages/shared-ui/src/Pill.tsx. */ +/** + * Pill tone union — kept in sync with packages/shared-ui/src/Pill.tsx. + * @public — consumed via an inline `import("~/lib/hub-blocks").PillTone` type + * reference in inspection-hub.tsx, which knip cannot trace (dynamic-import blind spot). + */ export type PillTone = | 'sat' | 'monitor' diff --git a/scripts/knip-baseline.json b/scripts/knip-baseline.json index 5b2046335..fe51488c7 100644 --- a/scripts/knip-baseline.json +++ b/scripts/knip-baseline.json @@ -1,7 +1 @@ -[ - "duplicates:server/lib/validations/auth.schema.ts:TotpDisableSchema|TotpRegenerateSchema", - "exports:server/lib/format.ts:formatDate", - "exports:server/lib/format.ts:formatTime", - "types:app/lib/hub-blocks.ts:PillTone", - "types:server/lib/validations/wizard.schema.ts:CreateInspectionFromWizardInput" -] +[] diff --git a/server/api/auth/totp.ts b/server/api/auth/totp.ts index 47ef55e00..53f40722b 100644 --- a/server/api/auth/totp.ts +++ b/server/api/auth/totp.ts @@ -22,7 +22,6 @@ import { signJwt, verifyJwt } from '../../lib/jwt-keyring'; import { TotpVerifySchema, TotpDisableSchema, - TotpRegenerateSchema, TotpLoginSchema, TotpSetupResponseSchema, Login2faResponseSchema @@ -97,7 +96,7 @@ const totpRegenRoute = createRoute(withMcpMetadata({ summary: 'Regenerate 2FA recovery codes', description: 'Invalidates all existing 2FA recovery codes and returns a fresh set of eight. Requires the current password plus a valid TOTP or recovery code.', tags: ['auth'], - request: { body: { content: { 'application/json': { schema: TotpRegenerateSchema.describe('TODO describe schema field for the OpenInspection MCP integration') } } } }, + request: { body: { content: { 'application/json': { schema: TotpDisableSchema.describe('TODO describe schema field for the OpenInspection MCP integration') } } } }, responses: { 200: { content: { 'application/json': { schema: TotpSetupResponseSchema.describe('TODO describe schema field for the OpenInspection MCP integration') } }, description: 'New recovery codes' }, 401: { description: 'Unauthorized' }, diff --git a/server/lib/validations/auth.schema.ts b/server/lib/validations/auth.schema.ts index 3db36f205..f193d8b0a 100644 --- a/server/lib/validations/auth.schema.ts +++ b/server/lib/validations/auth.schema.ts @@ -102,8 +102,6 @@ export const TotpDisableSchema = z.object({ }), }); -export const TotpRegenerateSchema = TotpDisableSchema; - export const TotpLoginSchema = z.object({ challengeToken: z.string().min(10).openapi({ example: 'eyJhbGciOiJI...', diff --git a/server/lib/validations/wizard.schema.ts b/server/lib/validations/wizard.schema.ts index 09db5affa..51b6439d5 100644 --- a/server/lib/validations/wizard.schema.ts +++ b/server/lib/validations/wizard.schema.ts @@ -30,4 +30,9 @@ export const CreateInspectionFromWizardSchema = z.object({ helperInspectorIds: z.array(z.string().min(1)).max(20).optional().describe('TODO describe helperInspectorIds field for the OpenInspection MCP integration'), }).openapi('CreateInspectionFromWizard'); +/** + * @public — consumed via inline `import('...').CreateInspectionFromWizardInput` + * type references in inspection.service.ts + inspection-core.service.ts, which + * knip cannot trace (dynamic-import blind spot). + */ export type CreateInspectionFromWizardInput = z.infer; diff --git a/tests/unit/platform/format-parity.spec.ts b/tests/unit/platform/format-parity.spec.ts index 5828ca097..a1d343399 100644 --- a/tests/unit/platform/format-parity.spec.ts +++ b/tests/unit/platform/format-parity.spec.ts @@ -6,6 +6,12 @@ import { describe, it, expect } from 'vitest'; import * as appFmt from '../../../app/lib/format'; import * as srvFmt from '../../../server/lib/format'; +// Static references so dead-code analysis sees these server exports as used — +// the parity loop below accesses them dynamically by name (knip cannot trace +// computed member access). formatDateTime/formatNumber/formatCurrency already +// have direct server consumers; formatDate/formatTime exist only for the twin. +void [srvFmt.formatDate, srvFmt.formatTime]; + const CASES = { formatDate: [ ['2026-07-17', { locale: 'en-US', timeZone: 'UTC', month: 'long' as const }], From 73c4561ca9ea9e6354d9ec36cdd3c5713590bc44 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 15:56:37 +0800 Subject: [PATCH 11/15] chore(lint): enable react-hooks, type-aware, react/a11y, and boundary/JWT guards (warn-first rollout) Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- eslint.config.js | 132 ++ package-lock.json | 2563 ++++++++++++++++++++++++++++++++++++- package.json | 7 +- server/lib/jwt-keyring.ts | 1 + 4 files changed, 2640 insertions(+), 63 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 9103aed8d..44e3881fa 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,5 +1,23 @@ import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; +import reactHooks from 'eslint-plugin-react-hooks'; +import react from 'eslint-plugin-react'; +import jsxA11y from 'eslint-plugin-jsx-a11y'; +import importX from 'eslint-plugin-import-x'; +import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'; + +// T-hooks warn-first rollout: downgrade every rule in a plugin's preset rules +// object to 'warn' (preserving any non-severity options), rather than hand- +// picking which of a preset's rules to enable. Used for jsx-a11y's flat +// recommended config below — see task-hooks-brief.md severity policy. +function toWarn(rules) { + return Object.fromEntries( + Object.entries(rules).map(([name, value]) => [ + name, + Array.isArray(value) ? ['warn', ...value.slice(1)] : 'warn', + ]), + ); +} export default tseslint.config( eslint.configs.recommended, @@ -31,6 +49,27 @@ export default tseslint.config( '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], 'no-console': ['error', { allow: ['warn', 'error', 'info'] }], + // T-hooks Tier 1 — type-checked rules, warn-first rollout (see + // task-hooks-brief.md). Not swapping to recommendedTypeChecked + // wholesale (would flip ~20 rules to error and fail CI); these are + // the specific rules called out, all at 'warn' pending cleanup. + // floating/misused-promises are the headline pre-release signal — + // silent unawaited promises are a data-loss bug class on Workers. + '@typescript-eslint/no-floating-promises': 'warn', + '@typescript-eslint/no-misused-promises': 'warn', + '@typescript-eslint/await-thenable': 'warn', + '@typescript-eslint/require-await': 'warn', + '@typescript-eslint/no-base-to-string': 'warn', + '@typescript-eslint/restrict-template-expressions': 'warn', + '@typescript-eslint/no-unnecessary-condition': 'warn', + '@typescript-eslint/no-unsafe-assignment': 'warn', + '@typescript-eslint/no-unsafe-member-access': 'warn', + '@typescript-eslint/no-unsafe-call': 'warn', + '@typescript-eslint/no-unsafe-return': 'warn', + '@typescript-eslint/no-unsafe-argument': 'warn', + // T-hooks Tier 3 — architecture/hygiene, warn (no --fix sweep; huge diff). + '@typescript-eslint/consistent-type-imports': 'warn', + '@typescript-eslint/no-import-type-side-effects': 'warn', // Round 5 lesson — Alpine v3 only auto-removes x-cloak from the x-data root. // x-cloak on a NESTED element combined with the // [x-cloak]{display:none!important} rule in main-layout permanently hides @@ -167,5 +206,98 @@ export default tseslint.config( }, ], }, + }, + { + // T-hooks Tier 2 — React hooks / RR + a11y, scoped to the frontend + + // shared component library (server/ has no JSX). rules-of-hooks is a + // genuine bug class (error, verified 0 violations); everything else is + // warn-first per task-hooks-brief.md — this is existing-code surfacing, + // not a fix-it-now gate. + files: ['app/**/*.{ts,tsx}', 'packages/shared-ui/src/**/*.{ts,tsx}'], + plugins: { + 'react-hooks': reactHooks, + react, + 'jsx-a11y': jsxA11y, + }, + languageOptions: { + parserOptions: { ecmaFeatures: { jsx: true } }, + }, + settings: { + // NOT 'detect': eslint-plugin-react 7.37.5's version-detection path calls + // context.getFilename(), which flat-config ESLint 10 no longer exposes on + // the rule context (TypeError: contextOrFilename.getFilename is not a + // function). Pinning the version explicitly (react's actual installed + // version) skips that codepath entirely. Bump this if/when React is + // upgraded, or revisit 'detect' once the plugin ships an ESLint-10 fix. + react: { version: '18.3.1' }, + }, + rules: { + // DOWNGRADED from the intended 'error' (task-hooks-brief.md Tier 2) to + // 'warn' — auditing found a genuine violation, not a false positive: + // app/components/editor/ItemEditor.tsx:343 calls useMemo() AFTER an + // early `if (!item) return null;` at line 242, so the hook only runs on + // some renders. Real bug, left unfixed here per the hard invariant (no + // mass-fix in this task) — flagged prominently in task-hooks-report.md + // for a human decision. Re-promote to 'error' once fixed. + 'react-hooks/rules-of-hooks': 'warn', + 'react-hooks/exhaustive-deps': 'warn', + // Deliberately NOT eslint-plugin-react's full `recommended` preset — + // prop-types etc. is noise in a TS codebase (types already enforce + // props). Only the rules called out in the brief. + 'react/react-in-jsx-scope': 'off', + 'react/jsx-key': 'warn', + 'react/no-array-index-key': 'warn', + 'react/no-unstable-nested-components': 'warn', + 'react/jsx-no-target-blank': 'warn', + // jsx-a11y's flat recommended, downgraded wholesale to 'warn' (see + // toWarn() above) rather than hand-picking a subset — the brief + // offers either; this gives fuller a11y audit coverage for free. + ...toWarn(jsxA11y.flatConfigs.recommended.rules), + }, + }, + { + // T-hooks Tier 3 — import-x/no-cycle (circular-dep guard for the + // service/di hub). Ordering rules (import/order etc.) are intentionally + // skipped — cosmetic and noisy per the brief. `import-x/resolver: + // {typescript: true}` (the legacy shorthand) errors ("invalid interface + // loaded as resolver") because no-cycle actually needs the + // `eslint-import-resolver-typescript` package resolved through the + // flat-config-only `resolver-next` API — added as a devDependency and + // wired below so path-mapped (~/*) and .ts-extensionless imports resolve. + files: ['**/*.ts', '**/*.tsx'], + plugins: { 'import-x': importX }, + settings: { + 'import-x/resolver-next': [createTypeScriptImportResolver()], + }, + rules: { + 'import-x/no-cycle': 'warn', + }, + }, + { + // T-hooks Tier 3/4 — app<->server BFF boundary + JWT sign/verify + // guard, combined into one no-restricted-imports rule (paths + + // patterns) per the brief. Both are 'error' ONLY because verified 0 + // violations (see task-hooks-report.md) — server/ never imports app/, + // and the sole hono/jwt import (server/lib/jwt-keyring.ts) is a + // verify-only import carrying an inline disable with a reason (the + // keyring IS the sanctioned wrapper). + files: ['server/**/*.ts'], + rules: { + 'no-restricted-imports': ['error', { + paths: [ + { + name: 'hono/jwt', + importNames: ['sign', 'verify'], + message: 'Use server/lib/jwt-keyring.ts (signJwt/verifyJwt) — direct hono/jwt sign/verify is forbidden (pins ES256 + kid). See CLAUDE.md JWT & Auth Security Rules.', + }, + ], + patterns: [ + { + group: ['**/app/*', '**/app/**', '~/*'], + message: 'server/ must not import from app/ (BFF boundary). Duplicate the pure util (see server/lib/format.ts twin) or move it to a shared location.', + }, + ], + }], + }, } ); diff --git a/package-lock.json b/package-lock.json index b603b52c7..6699fe301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,6 +74,11 @@ "cross-env": "^7.0.3", "drizzle-kit": "^0.31.7", "eslint": "^10.0.2", + "eslint-import-resolver-typescript": "^4.4.5", + "eslint-plugin-import-x": "^4.17.1", + "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", "fake-indexeddb": "^6.0.0", "happy-dom": "^20.9.0", "jscpd": "^5.0.11", @@ -5230,6 +5235,319 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@unrs/resolver-binding-android-arm-eabi": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.12.2.tgz", + "integrity": "sha512-g5T90pqg1bo/7mytQx6F4iBNC0Wsh9cu+z9veDbFjc7HjpesJFWD7QMS0NGStXM075+7dJPPVvBbpZlnrdpi/w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-android-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.12.2.tgz", + "integrity": "sha512-YGCRZv/9GLhwmz6mYDeTsm/92BAyR28l6c2ReweVW5pWgfsitWLY8upvfRlGdoyD8HjeTHSYJWyZGD4KJA/nFQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.12.2.tgz", + "integrity": "sha512-u9DiNT1auQMO20A9SyTuG3wUgQWB9Z7KjAg0uFuCDR1FsAY8A0CG2S6JpHS1xwm/w1G08bjXZDcyOCjv1WAm2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.12.2.tgz", + "integrity": "sha512-f7rPLi/T1HVKZu/u6t87lroib16n8vrSzcyxI7lg4BGO9UF26KhQL44sd9eOUgrTYhvRXtWOIZT5PejdPyJfUA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.12.2.tgz", + "integrity": "sha512-BpcOjWCJub6nRZUS2zA20pmLvjtqAtGejETaIyRLiZiQf++cbrjltLA5NN/xaXfqeOBOSlMFbemIl5/S5tljmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.12.2.tgz", + "integrity": "sha512-vZTDvdSISZjJx66OzJqtsOhzifbqRjbmI1Mnu49fQDwog5GtDI4QidRiEAYbZCRj9C8YZEW+3ZjqsyS9GR4k2A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.12.2.tgz", + "integrity": "sha512-BiPI+IrIlwcW4nLLMM21+B1dFPzd55yAVgVGrdgDjNef+ch03GdxrcyaIz8X9SsQirh/kCQ7mviyWlMxdh2D7g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.12.2.tgz", + "integrity": "sha512-zJc0H99FEPoFfSrNpa91HYfxzfAJCr502oxNK1cfdC9hlaFI43RT+JFCann9JUgZmLzzntChHyn13Sgn9ljHNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.12.2.tgz", + "integrity": "sha512-KQ3Lki6l+Pz1k/eBipN41ES+YUK30beLGb9YqcB1O542cyLCNE6GaxrfcY3T6EezmGGk84wb5XyO9loTM9tkcA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-loong64-gnu/-/resolver-binding-linux-loong64-gnu-1.12.2.tgz", + "integrity": "sha512-3SJGEh1DborhG6pyxvhPzCT4bbSIVihsvgJc13P1bHG7KLdNDaF9T3gsTwFc7Jw/5Y5/iWOjkEx7Zy0NvCGX3Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-loong64-musl/-/resolver-binding-linux-loong64-musl-1.12.2.tgz", + "integrity": "sha512-jiuG/Obbel7uw1PwHNFfrkiKhLAF6mnyZ6aWlOAVN9WqKm8v0OFGnciJIHu8+CMvXLQ8AD51LPzAoUfT21D5Ew==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.12.2.tgz", + "integrity": "sha512-q7xRvVpmcfeL+LlZg8Pbbo6QaTZwDU5BaGZbwfhkEsXJn3Was8xYfE0RBH266xZt0rM6B7i8xAYIvjthuUIWHg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.12.2.tgz", + "integrity": "sha512-0CVdx6lcnT3Q9inOH8tsMIOJ6ImndllMjqJHg8RLVdB7Vq4SfkEXl9mCSsVNuNA4MCYycRicCUxPCabVHJRr6A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.12.2.tgz", + "integrity": "sha512-iOwlRo9vnp6R6ohHQS11n0NnfdXx/omhkocmIfaPRpQhKZ+3BDMkkdRVh53qjkFkpPddf+FETA28NwGN7l5l+w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.12.2.tgz", + "integrity": "sha512-HYJtLfXq94q8iZNFT1lknx258wlkkWhZeUXJRqzKBBUJ00CvZ+N33zgbCqimLjsyw5Va6uUxhVa12mI+kaveEw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.12.2.tgz", + "integrity": "sha512-mPsUhunKKDih5O96Y6enDQyHc1SqBPlY1E/SfMWDM3EdJ95Z9CArPeCVwCCqbP45ljvivdEk8Fxn+SIb1rDAJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.12.2.tgz", + "integrity": "sha512-azrt6+5ydLd8Vt210AAFis/lZevSfPw93EJRIJG+xPu4WCJ8K0kppCTpMyLPcKT7H15M4Jnt2tMp5bOvCkRC6A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-openharmony-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-openharmony-arm64/-/resolver-binding-openharmony-arm64-1.12.2.tgz", + "integrity": "sha512-YZ9hP4O0X9PQb8eO980qmLNGH4zT3I9+SZTdt0Pr0YyuGQhYKoOZkV02VzrzyOZJ5xIJ3UFIenKkUkGg8GjgWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.12.2.tgz", + "integrity": "sha512-tYFDIkMxSflfEc/h92ZWNsZlHSwgimbNHSO3PL2JWQHfCuC2q316jMyYU9TIWZsFK2bQwyK5VAdYgn8ygPj69A==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz", + "integrity": "sha512-qzNyg3xL0VPQmCaUh+N5jSitce6k+uCBfMDesWRnlULOZaqUkaJ0ybdT+UqlAWJoQjuqfIU/0Ptx9bteN4D82g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.12.2.tgz", + "integrity": "sha512-WD9sY00OfpHVGfsnHZoA8jVT+esS/Bg8z8jzxp5BnDCjjwsuKsPQrzswwpFy4J1AUJbXPRfkpcX0mXrzeXW79g==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.12.2.tgz", + "integrity": "sha512-nAB74NfSNKknqQ1RrYj6uz8FcXEomu/MATJZxh/x+BArzN2U3JbOYC0APYzUIGhVY3m5hRxA8VPNdPBoG8txlA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@vitest/expect": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.3.tgz", @@ -5626,38 +5944,229 @@ "dequal": "^2.0.3" } }, - "node_modules/array-timsort": { - "version": "1.0.3", - "resolved": "https://registry.npmmirror.com/array-timsort/-/array-timsort-1.0.3.tgz", - "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", - "license": "MIT" - }, - "node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", "dev": true, "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmmirror.com/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "license": "MIT" - }, - "node_modules/babel-dead-code-elimination": { - "version": "1.0.12", - "resolved": "https://registry.npmmirror.com/babel-dead-code-elimination/-/babel-dead-code-elimination-1.0.12.tgz", - "integrity": "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig==", + "node_modules/array-includes": { + "version": "3.1.9", + "resolved": "https://registry.npmmirror.com/array-includes/-/array-includes-3.1.9.tgz", + "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/core": "^7.23.7", - "@babel/parser": "^7.23.6", - "@babel/traverse": "^7.23.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.0", + "es-object-atoms": "^1.1.1", + "get-intrinsic": "^1.3.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-timsort": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/array-timsort/-/array-timsort-1.0.3.tgz", + "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", + "license": "MIT" + }, + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmmirror.com/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmmirror.com/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmmirror.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/ast-types-flow": { + "version": "0.0.8", + "resolved": "https://registry.npmmirror.com/ast-types-flow/-/ast-types-flow-0.0.8.tgz", + "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmmirror.com/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axe-core": { + "version": "4.12.1", + "resolved": "https://registry.npmmirror.com/axe-core/-/axe-core-4.12.1.tgz", + "integrity": "sha512-s7iGf5GaVMxEG0ENN9x+xTr7GFZCb1ZP/1uATUpCEK2X78nDB3RwbtFCo9pGAf9ru+VwoQ464DkaLEeRM08wJA==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/babel-dead-code-elimination": { + "version": "1.0.12", + "resolved": "https://registry.npmmirror.com/babel-dead-code-elimination/-/babel-dead-code-elimination-1.0.12.tgz", + "integrity": "sha512-GERT7L2TiYcYDtYk1IpD+ASAYXjKbLTDPhBtYj7X1NuRMDTMtAx9kyBenub1Ev41lo91OHCKdmP+egTDmfQ7Ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.23.7", + "@babel/parser": "^7.23.6", + "@babel/traverse": "^7.23.7", "@babel/types": "^7.23.6" } }, @@ -5935,6 +6444,25 @@ "node": ">=8" } }, + "node_modules/call-bind": { + "version": "1.0.9", + "resolved": "https://registry.npmmirror.com/call-bind/-/call-bind-1.0.9.tgz", + "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "get-intrinsic": "^1.3.0", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -6164,6 +6692,16 @@ "node": ">= 6" } }, + "node_modules/comment-parser": { + "version": "1.4.7", + "resolved": "https://registry.npmmirror.com/comment-parser/-/comment-parser-1.4.7.tgz", + "integrity": "sha512-0h+uSNtQGW3D98eQt3jJ8L06Fves8hncB4V/PKdw/Qb8Hnk19VaKuTr55UNRYiSoVa7WwrFls+rh3ux9agmkeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12.0.0" + } + }, "node_modules/compress-commons": { "version": "4.1.2", "resolved": "https://registry.npmmirror.com/compress-commons/-/compress-commons-4.1.2.tgz", @@ -6444,6 +6982,67 @@ "dev": true, "license": "MIT" }, + "node_modules/damerau-levenshtein": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", + "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/dayjs": { "version": "1.11.21", "resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.21.tgz", @@ -6524,6 +7123,42 @@ "dev": true, "license": "MIT" }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz", @@ -6559,6 +7194,19 @@ "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", "license": "MIT" }, + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/docx": { "version": "9.7.1", "resolved": "https://registry.npmmirror.com/docx/-/docx-9.7.1.tgz", @@ -6894,20 +7542,136 @@ "url": "https://github.com/sponsors/antfu" } }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "node_modules/es-abstract": { + "version": "1.24.2", + "resolved": "https://registry.npmmirror.com/es-abstract/-/es-abstract-1.24.2.tgz", + "integrity": "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==", + "dev": true, "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "node_modules/es-abstract-get": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/es-abstract-get/-/es-abstract-get-1.0.0.tgz", + "integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.2", + "is-callable": "^1.2.7", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/es-iterator-helpers/-/es-iterator-helpers-1.4.0.tgz", + "integrity": "sha512-c/A0P0oxkACDc+cKWw8evLXK83oBKgn0qPOqCYT4x9uolpCIJAcYvJC9QYKNDRPsTeGyCrQ326jrvgZWdCdK5Q==", + "dev": true, "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.1.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.3.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.5", + "math-intrinsics": "^1.1.0" + }, "engines": { "node": ">= 0.4" } @@ -6931,6 +7695,56 @@ "node": ">= 0.4" } }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.4", + "resolved": "https://registry.npmmirror.com/es-to-primitive/-/es-to-primitive-1.3.4.tgz", + "integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-abstract-get": "^1.0.0", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "is-callable": "^1.2.7", + "is-date-object": "^1.1.0", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/esbuild": { "version": "0.28.1", "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.28.1.tgz", @@ -7059,6 +7873,275 @@ } } }, + "node_modules/eslint-import-context": { + "version": "0.1.9", + "resolved": "https://registry.npmmirror.com/eslint-import-context/-/eslint-import-context-0.1.9.tgz", + "integrity": "sha512-K9Hb+yRaGAGUbwjhFNHvSmmkZs9+zbuoe3kFQ4V1wYjrepUFYM2dZAfNtjbbj3qsPfUfsA68Bx/ICWQMi+C8Eg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-tsconfig": "^4.10.1", + "stable-hash-x": "^0.2.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-context" + }, + "peerDependencies": { + "unrs-resolver": "^1.0.0" + }, + "peerDependenciesMeta": { + "unrs-resolver": { + "optional": true + } + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "4.4.5", + "resolved": "https://registry.npmmirror.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.4.5.tgz", + "integrity": "sha512-nbE5XLph6TLtGYcu/U6e6ZVXyKBhbDWK5cLGk76eJ7NdZpwf1P9EFkpt1Z01mNZNrrilsAYWKH6zUkL4reoXbw==", + "dev": true, + "license": "ISC", + "dependencies": { + "debug": "^4.4.1", + "eslint-import-context": "^0.1.8", + "get-tsconfig": "^4.10.1", + "is-bun-module": "^2.0.0", + "stable-hash-x": "^0.2.0", + "tinyglobby": "^0.2.14", + "unrs-resolver": "^1.7.11" + }, + "engines": { + "node": "^16.17.0 || >=18.6.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-resolver-typescript" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-import-x": { + "version": "4.17.1", + "resolved": "https://registry.npmmirror.com/eslint-plugin-import-x/-/eslint-plugin-import-x-4.17.1.tgz", + "integrity": "sha512-4cdstYkKCyjumM2Q9NSI03K8D2a9F4Ssz33K2lv2hQa4KmR9jPLwk3uWGtNvclfqBrPGfGuMBwsGMbe6dMRbfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "^8.56.0", + "comment-parser": "^1.4.1", + "debug": "^4.4.1", + "eslint-import-context": "^0.1.9", + "is-glob": "^4.0.3", + "minimatch": "^9.0.3 || ^10.1.2", + "semver": "^7.7.2", + "stable-hash-x": "^0.2.0", + "unrs-resolver": "^1.9.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-import-x" + }, + "peerDependencies": { + "@typescript-eslint/utils": "^8.56.0", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "eslint-import-resolver-node": "*" + }, + "peerDependenciesMeta": { + "@typescript-eslint/utils": { + "optional": true + }, + "eslint-import-resolver-node": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-jsx-a11y": { + "version": "6.10.2", + "resolved": "https://registry.npmmirror.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.10.2.tgz", + "integrity": "sha512-scB3nz4WmG75pV8+3eRUQOHZlNSUhFNq37xnpgRkCCELU3XMvXAxLk1eqWWyE22Ki4Q01Fnsw9BA3cJHDPgn2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "aria-query": "^5.3.2", + "array-includes": "^3.1.8", + "array.prototype.flatmap": "^1.3.2", + "ast-types-flow": "^0.0.8", + "axe-core": "^4.10.0", + "axobject-query": "^4.1.0", + "damerau-levenshtein": "^1.0.8", + "emoji-regex": "^9.2.2", + "hasown": "^2.0.2", + "jsx-ast-utils": "^3.3.5", + "language-tags": "^1.0.9", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "safe-regex-test": "^1.0.3", + "string.prototype.includes": "^2.0.1" + }, + "engines": { + "node": ">=4.0" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/aria-query": { + "version": "5.3.2", + "resolved": "https://registry.npmmirror.com/aria-query/-/aria-query-5.3.2.tgz", + "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.37.5", + "resolved": "https://registry.npmmirror.com/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", + "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.9", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmmirror.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-react/node_modules/brace-expansion": { + "version": "1.1.16", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.16.tgz", + "integrity": "sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/eslint-scope": { "version": "9.1.2", "resolved": "https://registry.npmmirror.com/eslint-scope/-/eslint-scope-9.1.2.tgz", @@ -7561,6 +8644,22 @@ "dev": true, "license": "ISC" }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmmirror.com/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/formatly": { "version": "0.3.0", "resolved": "https://registry.npmmirror.com/formatly/-/formatly-0.3.0.tgz", @@ -7647,19 +8746,63 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmmirror.com/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "node_modules/function.prototype.name": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/function.prototype.name/-/function.prototype.name-1.2.0.tgz", + "integrity": "sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==", "dev": true, "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2", + "hasown": "^2.0.4", + "is-callable": "^1.2.7", + "is-document.all": "^1.0.0" + }, "engines": { - "node": ">=6.9.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmmirror.com/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmmirror.com/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "license": "ISC", "engines": { @@ -7715,6 +8858,24 @@ "node": ">= 0.4" } }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-tsconfig": { "version": "4.14.0", "resolved": "https://registry.npmmirror.com/get-tsconfig/-/get-tsconfig-4.14.0.tgz", @@ -7797,6 +8958,23 @@ "node": "*" } }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz", @@ -7833,6 +9011,48 @@ "node": ">=20.0.0" } }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz", @@ -7845,6 +9065,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmmirror.com/hash.js/-/hash.js-1.1.7.tgz", @@ -7867,6 +9103,23 @@ "node": ">= 0.4" } }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmmirror.com/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmmirror.com/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, "node_modules/hono": { "version": "4.12.26", "resolved": "https://registry.npmmirror.com/hono/-/hono-4.12.26.tgz", @@ -7991,6 +9244,21 @@ "dev": true, "license": "ISC" }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ip-address": { "version": "10.2.0", "resolved": "https://registry.npmmirror.com/ip-address/-/ip-address-10.2.0.tgz", @@ -8009,49 +9277,441 @@ "node": ">= 0.10" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmmirror.com/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.7.1" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmmirror.com/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.2", + "resolved": "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-document.all": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/is-document.all/-/is-document.all-1.0.0.tgz", + "integrity": "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz", + "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-east-asian-width": "^1.3.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmmirror.com/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmmirror.com/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmmirror.com/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-fullwidth-code-point": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz", - "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==", + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", "dev": true, "license": "MIT", "dependencies": { - "get-east-asian-width": "^1.3.1" + "call-bound": "^1.0.3" }, "engines": { - "node": ">=18" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmmirror.com/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", "dev": true, "license": "MIT", "dependencies": { - "is-extglob": "^2.1.1" + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-promise": { - "version": "4.0.0", - "resolved": "https://registry.npmmirror.com/is-promise/-/is-promise-4.0.0.tgz", - "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, "license": "MIT" }, "node_modules/isbot": { @@ -8079,6 +9739,24 @@ "url": "https://github.com/sponsors/dmonad" } }, + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmmirror.com/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/its-fine": { "version": "1.2.5", "resolved": "https://registry.npmmirror.com/its-fine/-/its-fine-1.2.5.tgz", @@ -8200,6 +9878,22 @@ "node": ">=6" } }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmmirror.com/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, "node_modules/jszip": { "version": "3.10.1", "resolved": "https://registry.npmmirror.com/jszip/-/jszip-3.10.1.tgz", @@ -8350,6 +10044,26 @@ "node": ">=20.0.0" } }, + "node_modules/language-subtag-registry": { + "version": "0.3.23", + "resolved": "https://registry.npmmirror.com/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz", + "integrity": "sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/language-tags": { + "version": "1.0.9", + "resolved": "https://registry.npmmirror.com/language-tags/-/language-tags-1.0.9.tgz", + "integrity": "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==", + "dev": true, + "license": "MIT", + "dependencies": { + "language-subtag-registry": "^0.3.20" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/lazystream": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/lazystream/-/lazystream-1.0.1.tgz", @@ -9136,6 +10850,22 @@ "dev": true, "license": "MIT" }, + "node_modules/napi-postinstall": { + "version": "0.3.4", + "resolved": "https://registry.npmmirror.com/napi-postinstall/-/napi-postinstall-0.3.4.tgz", + "integrity": "sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==", + "dev": true, + "license": "MIT", + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -9165,6 +10895,35 @@ "node": ">=10" } }, + "node_modules/node-exports-info": { + "version": "1.6.2", + "resolved": "https://registry.npmmirror.com/node-exports-info/-/node-exports-info-1.6.2.tgz", + "integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==", + "dev": true, + "license": "MIT", + "dependencies": { + "array.prototype.flatmap": "^1.3.3", + "es-errors": "^1.3.0", + "object.entries": "^1.1.9", + "semver": "^6.3.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/node-exports-info/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmmirror.com/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/node-releases": { "version": "2.0.46", "resolved": "https://registry.npmmirror.com/node-releases/-/node-releases-2.0.46.tgz", @@ -9211,6 +10970,91 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmmirror.com/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.9", + "resolved": "https://registry.npmmirror.com/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmmirror.com/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/obug": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", @@ -9298,6 +11142,24 @@ "url": "https://github.com/hectorm/otpauth?sponsor=1" } }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/oxc-parser": { "version": "0.137.0", "resolved": "https://registry.npmmirror.com/oxc-parser/-/oxc-parser-0.137.0.tgz", @@ -9509,6 +11371,13 @@ "node": ">=8" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, "node_modules/path-to-regexp": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", @@ -9637,6 +11506,16 @@ "node": ">=10.13.0" } }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/postcss": { "version": "8.5.15", "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.15.tgz", @@ -10303,6 +12182,50 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmmirror.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmmirror.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -10327,6 +12250,30 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "license": "ISC" }, + "node_modules/resolve": { + "version": "2.0.0-next.7", + "resolved": "https://registry.npmmirror.com/resolve/-/resolve-2.0.0-next.7.tgz", + "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.2", + "node-exports-info": "^1.6.0", + "object-keys": "^1.1.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -10539,6 +12486,26 @@ "url": "https://opencollective.com/express" } }, + "node_modules/safe-array-concat": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/safe-array-concat/-/safe-array-concat-1.1.4.tgz", + "integrity": "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "get-intrinsic": "^1.3.0", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -10559,6 +12526,41 @@ ], "license": "MIT" }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmmirror.com/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -10689,6 +12691,55 @@ "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", "license": "MIT" }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmmirror.com/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmmirror.com/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmmirror.com/setimmediate/-/setimmediate-1.0.5.tgz", @@ -10984,6 +13035,16 @@ "kysely": "*" } }, + "node_modules/stable-hash-x": { + "version": "0.2.0", + "resolved": "https://registry.npmmirror.com/stable-hash-x/-/stable-hash-x-0.2.0.tgz", + "integrity": "sha512-o3yWv49B/o4QZk5ZcsALc6t0+eCelPc44zZsLtCQnZPDwFpDYSWcDnrv2TtMmMbQ7uKo3J0HTURCqckw23czNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -11007,6 +13068,20 @@ "dev": true, "license": "MIT" }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -11043,6 +13118,120 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/string.prototype.includes": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/string.prototype.includes/-/string.prototype.includes-2.0.1.tgz", + "integrity": "sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmmirror.com/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.11", + "resolved": "https://registry.npmmirror.com/string.prototype.trim/-/string.prototype.trim-1.2.11.tgz", + "integrity": "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-object-atoms": "^1.1.2", + "has-property-descriptors": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.10", + "resolved": "https://registry.npmmirror.com/string.prototype.trimend/-/string.prototype.trimend-1.0.10.tgz", + "integrity": "sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/strip-ansi": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", @@ -11098,6 +13287,19 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/swagger-ui-dist": { "version": "5.32.5", "resolved": "https://registry.npmmirror.com/swagger-ui-dist/-/swagger-ui-dist-5.32.5.tgz", @@ -11372,6 +13574,84 @@ "url": "https://opencollective.com/express" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmmirror.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.8", + "resolved": "https://registry.npmmirror.com/typed-array-length/-/typed-array-length-1.0.8.tgz", + "integrity": "sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "is-typed-array": "^1.1.15", + "possible-typed-array-names": "^1.1.0", + "reflect.getprototypeof": "^1.0.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", @@ -11420,6 +13700,25 @@ "node": ">=14" } }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmmirror.com/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/undici": { "version": "7.28.0", "resolved": "https://registry.npmmirror.com/undici/-/undici-7.28.0.tgz", @@ -11471,6 +13770,44 @@ "node": ">=18.12.0" } }, + "node_modules/unrs-resolver": { + "version": "1.12.2", + "resolved": "https://registry.npmmirror.com/unrs-resolver/-/unrs-resolver-1.12.2.tgz", + "integrity": "sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "napi-postinstall": "^0.3.4" + }, + "funding": { + "url": "https://opencollective.com/unrs-resolver" + }, + "optionalDependencies": { + "@unrs/resolver-binding-android-arm-eabi": "1.12.2", + "@unrs/resolver-binding-android-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-x64": "1.12.2", + "@unrs/resolver-binding-freebsd-x64": "1.12.2", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-arm64-musl": "1.12.2", + "@unrs/resolver-binding-linux-loong64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-loong64-musl": "1.12.2", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-musl": "1.12.2", + "@unrs/resolver-binding-linux-s390x-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-musl": "1.12.2", + "@unrs/resolver-binding-openharmony-arm64": "1.12.2", + "@unrs/resolver-binding-wasm32-wasi": "1.12.2", + "@unrs/resolver-binding-win32-arm64-msvc": "1.12.2", + "@unrs/resolver-binding-win32-ia32-msvc": "1.12.2", + "@unrs/resolver-binding-win32-x64-msvc": "1.12.2" + } + }, "node_modules/unzipper": { "version": "0.10.14", "resolved": "https://registry.npmmirror.com/unzipper/-/unzipper-0.10.14.tgz", @@ -11956,12 +14293,101 @@ "node": ">= 8" } }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-module": { "version": "2.0.1", "resolved": "https://registry.npmmirror.com/which-module/-/which-module-2.0.1.tgz", "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", "license": "ISC" }, + "node_modules/which-typed-array": { + "version": "1.1.22", + "resolved": "https://registry.npmmirror.com/which-typed-array/-/which-typed-array-1.1.22.tgz", + "integrity": "sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/why-is-node-running": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", @@ -12586,6 +15012,19 @@ "peerDependencies": { "zod": "^3.25.28 || ^4" } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmmirror.com/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } } } } diff --git a/package.json b/package.json index 38411eb14..527d772da 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "type-check": "npm run i18n:compile && react-router typegen && npm run type-check:app && npm run type-check:api", "type-check:app": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.json --noEmit --incremental --tsBuildInfoFile ./.tsbuildinfo.app", "type-check:api": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.api.json --noEmit --incremental --tsBuildInfoFile ./.tsbuildinfo.api", - "lint": "eslint . --cache && npm run lint:ds && npm run lint:svg && npm run lint:erasure && npm run lint:migrefs && npm run lint:filesize && npm run lint:dup && npm run lint:tenant-scope && npm run lint:tests && npm run lint:deadcode && npm run lint:timestamps && npm run lint:tz && npm run lint:i18n && npm run lint:i18n-catalog && npm run lint:naming", + "lint": "cross-env NODE_OPTIONS=--max-old-space-size=8192 eslint . --cache && npm run lint:ds && npm run lint:svg && npm run lint:erasure && npm run lint:migrefs && npm run lint:filesize && npm run lint:dup && npm run lint:tenant-scope && npm run lint:tests && npm run lint:deadcode && npm run lint:timestamps && npm run lint:tz && npm run lint:i18n && npm run lint:i18n-catalog && npm run lint:naming", "lint:ds": "node scripts/check-ds-tokens.mjs", "lint:naming": "node scripts/check-naming.mjs", "lint:svg": "node scripts/check-svg-dimensions.mjs", @@ -150,6 +150,11 @@ "cross-env": "^7.0.3", "drizzle-kit": "^0.31.7", "eslint": "^10.0.2", + "eslint-import-resolver-typescript": "^4.4.5", + "eslint-plugin-import-x": "^4.17.1", + "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^7.1.1", "fake-indexeddb": "^6.0.0", "happy-dom": "^20.9.0", "jscpd": "^5.0.11", diff --git a/server/lib/jwt-keyring.ts b/server/lib/jwt-keyring.ts index b649f7996..49ee1d52b 100644 --- a/server/lib/jwt-keyring.ts +++ b/server/lib/jwt-keyring.ts @@ -14,6 +14,7 @@ * scripts and CLAUDE.md "JWT & Auth Security Rules". */ +// eslint-disable-next-line no-restricted-imports -- this IS the sanctioned keyring wrapper; verifyJwt() below is the only caller allowed to reach hono/jwt's verify() directly (see CLAUDE.md JWT & Auth Security Rules). import { verify as honoVerify } from 'hono/jwt'; interface JwtKeyringEntry { From 58b65173b4fd021bff2d445e01efc70b808b37e7 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 16:16:20 +0800 Subject: [PATCH 12/15] fix(lint): don't warn-ify jsx-a11y off-by-design rules; content cache-strategy Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- eslint.config.js | 20 ++++++++++++++++---- package.json | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 44e3881fa..58cc1417b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -10,12 +10,24 @@ import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescrip // object to 'warn' (preserving any non-severity options), rather than hand- // picking which of a preset's rules to enable. Used for jsx-a11y's flat // recommended config below — see task-hooks-brief.md severity policy. +// +// Rules the preset ships as 'off'/0 by design (deprecated rules like +// jsx-a11y/label-has-for, or rules superseded by another on-rule like +// anchor-ambiguous-text / control-has-associated-label) must NOT be force- +// enabled here — filter those out first, then only warn-ify what the preset +// actually turns on. (T-hooks review fix — the first pass warn-ified +// everything including the off-by-design rules, corrupting the audit table.) function toWarn(rules) { return Object.fromEntries( - Object.entries(rules).map(([name, value]) => [ - name, - Array.isArray(value) ? ['warn', ...value.slice(1)] : 'warn', - ]), + Object.entries(rules) + .filter(([, value]) => { + const severity = Array.isArray(value) ? value[0] : value; + return severity !== 'off' && severity !== 0; + }) + .map(([name, value]) => [ + name, + Array.isArray(value) ? ['warn', ...value.slice(1)] : 'warn', + ]), ); } diff --git a/package.json b/package.json index 527d772da..0b724a339 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "type-check": "npm run i18n:compile && react-router typegen && npm run type-check:app && npm run type-check:api", "type-check:app": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.json --noEmit --incremental --tsBuildInfoFile ./.tsbuildinfo.app", "type-check:api": "node --max-old-space-size=8192 ./node_modules/typescript/bin/tsc -p tsconfig.api.json --noEmit --incremental --tsBuildInfoFile ./.tsbuildinfo.api", - "lint": "cross-env NODE_OPTIONS=--max-old-space-size=8192 eslint . --cache && npm run lint:ds && npm run lint:svg && npm run lint:erasure && npm run lint:migrefs && npm run lint:filesize && npm run lint:dup && npm run lint:tenant-scope && npm run lint:tests && npm run lint:deadcode && npm run lint:timestamps && npm run lint:tz && npm run lint:i18n && npm run lint:i18n-catalog && npm run lint:naming", + "lint": "cross-env NODE_OPTIONS=--max-old-space-size=8192 eslint . --cache --cache-strategy content && npm run lint:ds && npm run lint:svg && npm run lint:erasure && npm run lint:migrefs && npm run lint:filesize && npm run lint:dup && npm run lint:tenant-scope && npm run lint:tests && npm run lint:deadcode && npm run lint:timestamps && npm run lint:tz && npm run lint:i18n && npm run lint:i18n-catalog && npm run lint:naming", "lint:ds": "node scripts/check-ds-tokens.mjs", "lint:naming": "node scripts/check-naming.mjs", "lint:svg": "node scripts/check-svg-dimensions.mjs", From 81cebe4add20317b09063e4d2099f2952654f3b6 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 17:07:41 +0800 Subject: [PATCH 13/15] fix(team): re-assert status='pending' in cancelInvite DELETE (close TOCTOU) An invite accepted between cancelInvite's existence SELECT and its DELETE would get its now-historical row hard-deleted. Fold the status check into the DELETE where-clause so the race no-ops instead. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- server/services/team.service.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/services/team.service.ts b/server/services/team.service.ts index f363ec448..fec6c7f6d 100644 --- a/server/services/team.service.ts +++ b/server/services/team.service.ts @@ -2,7 +2,7 @@ import { drizzle } from 'drizzle-orm/d1'; import { users, tenantInvites, tenants } from '../lib/db/schema'; import { eq, and, isNull } from 'drizzle-orm'; import type { OAuthHelpers } from '@cloudflare/workers-oauth-provider'; -import { UserRole } from '../types/auth'; +import type { UserRole } from '../types/auth'; import { Errors } from '../lib/errors'; import { logger } from '../lib/logger'; import type { UserSyncOutbox } from '../lib/integration/user-sync'; @@ -138,8 +138,15 @@ export class TeamService { )) .get(); if (!invite) throw Errors.NotFound('Invite not found'); + // Re-assert status='pending' in the DELETE itself: if the invite is + // accepted between the SELECT above and here, this no-ops rather than + // hard-deleting the now-historical row (closes the TOCTOU window). await db.delete(tenantInvites) - .where(and(eq(tenantInvites.id, token), eq(tenantInvites.tenantId, tenantId))); + .where(and( + eq(tenantInvites.id, token), + eq(tenantInvites.tenantId, tenantId), + eq(tenantInvites.status, 'pending'), + )); } /** From 99119089a7b6da7af236fd2b0a3d236c4363891e Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 18:01:21 +0800 Subject: [PATCH 14/15] fix: post-release triage wave (team names, hooks, deep-link, dead keys, promises) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fast-follows surfaced by the final review, folded before release: - team: getMembers now selects users.name and TeamMembersResponseSchema exposes it, so /team active rows render the real name instead of "Unnamed". - editor/ItemEditor: the visibleTabs derivation sat after the `if (!item)` early return as a useMemo — a conditional hook (react-hooks/rules-of-hooks). Demote it to a plain const (a 3-id map isn't worth memoizing). - contacts: the loader filtered contacts server-side by `?type=`, starving the Agents tab on a `?type=client` deep-link. Fetch the full list; both tabs already filter locally (Contacts by state seeded from ?type=, Agents by type). - i18n: drop 3 orphaned keys left by the Agents-table rewrite (contacts_agents_col_status / _col_linked / _revoke; zero code refs). - lint(no-misused-promises): set checksVoidReturn.attributes:false — async JSX event handlers are idiomatic React; this removed 44 false positives (45 -> 1). - durable-objects/inspection-doc: `void` the ctor blockConcurrencyWhile — the one genuine server-side floating promise (the runtime gates on it internally; a ctor cannot await). The other 149 no-floating-promises are RR fetcher/ navigate idioms with no server-executed mutations; left as warn. - test(magic-login): bump the whole-app-graph allowlist test's timeout 30s -> 60s so it can't flake under concurrent CI load. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- app/components/editor/ItemEditor.tsx | 12 ++++++------ app/routes/contacts.tsx | 8 +++++++- eslint.config.js | 8 +++++++- messages/en/contacts.json | 3 --- server/durable-objects/inspection-doc.ts | 2 +- server/lib/validations/admin/compliance.ts | 1 + server/services/team.service.ts | 1 + tests/unit/agent/magic-login.spec.ts | 2 +- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/components/editor/ItemEditor.tsx b/app/components/editor/ItemEditor.tsx index ec12d746c..ba84dfb5c 100644 --- a/app/components/editor/ItemEditor.tsx +++ b/app/components/editor/ItemEditor.tsx @@ -6,7 +6,7 @@ import { flattenItemTabs, fragmentBeforeCaret, replaceFragmentBeforeCaret, } from "../../lib/comment-typeahead"; import { CloneLastButton } from "./CloneLastButton"; -import { type DefectFieldsValue } from "./DefectFieldsRow"; +import type { DefectFieldsValue } from "./DefectFieldsRow"; import { ItemAttributesPanel } from "./ItemAttributesPanel"; import { RatingButtonRow } from "./RatingButtonRow"; import { @@ -339,12 +339,12 @@ export function ItemEditor({ setCustomFormOpen(false); }; - // Build visible tabs for shared TabStrip (only tabs with entries) - const visibleTabs = useMemo(() => - CANNED_TAB_IDS + // Visible canned tabs (only tabs with entries). A plain derivation, NOT a + // hook: it sits after the `if (!item) return null` early return, so a useMemo + // here would be a conditional hook (rules-of-hooks). The 3-id map is cheap. + const visibleTabs = CANNED_TAB_IDS .filter((id) => ((tabs[id] || []) as unknown[]).length > 0) - .map((id) => ({ id, label: cannedTabLabel(id), count: getIncludedSet(id).size || undefined })), - [tabs, result]); + .map((id) => ({ id, label: cannedTabLabel(id), count: getIncludedSet(id).size || undefined })); // Photo count is read in several places (badge, caption, empty-state copy). const photoCount = ((result.photos as unknown[]) || []).length; diff --git a/app/routes/contacts.tsx b/app/routes/contacts.tsx index 1a5672df3..5e2f22374 100644 --- a/app/routes/contacts.tsx +++ b/app/routes/contacts.tsx @@ -44,7 +44,13 @@ export async function loader({ request, context }: Route.LoaderArgs) { try { const [contactsRes, rolesRes, emailTemplatesRes, smsTemplatesRes] = await Promise.all([ - api.contacts.index.$get({ query: filterType === "agent" || filterType === "client" ? { type: filterType } : {} }), + // Always fetch the full contact list, regardless of the URL `?type=` + // filter. Both tabs filter locally — the Contacts tab by the `typeFilter` + // state (seeded from `?type=`) and the Agents tab by `type === 'agent'`. + // Filtering server-side would starve the Agents tab on a `?type=client` + // deep-link (it would receive zero agents). `filterType` still seeds the + // dropdown below so the deep-link intent is preserved for the Contacts tab. + api.contacts.index.$get({ query: {} }), api.roleProfiles.index.$get(), api.messageTemplates.index.$get({ query: { channel: "email" } }).catch(() => null), api.messageTemplates.index.$get({ query: { channel: "sms" } }).catch(() => null), diff --git a/eslint.config.js b/eslint.config.js index 58cc1417b..c582a8bbc 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -68,7 +68,13 @@ export default tseslint.config( // floating/misused-promises are the headline pre-release signal — // silent unawaited promises are a data-loss bug class on Workers. '@typescript-eslint/no-floating-promises': 'warn', - '@typescript-eslint/no-misused-promises': 'warn', + // `checksVoidReturn.attributes: false` — passing an async function to + // a JSX event-handler prop (`onClick={async () => …}`) is idiomatic + // React (the return is ignored by design); flagging it is pure noise. + // The pre-release triage confirmed 43/45 misused-promises hits were + // exactly this pattern and zero were server-executed. The remaining + // argument/return/property checks stay on to catch genuine misuse. + '@typescript-eslint/no-misused-promises': ['warn', { checksVoidReturn: { attributes: false } }], '@typescript-eslint/await-thenable': 'warn', '@typescript-eslint/require-await': 'warn', '@typescript-eslint/no-base-to-string': 'warn', diff --git a/messages/en/contacts.json b/messages/en/contacts.json index 12e4e5412..2d74e38cd 100644 --- a/messages/en/contacts.json +++ b/messages/en/contacts.json @@ -30,9 +30,6 @@ "contacts_table_col_name": "Name", "contacts_table_col_actions": "Actions", "contacts_agents_empty_title": "No agent partners yet", - "contacts_agents_col_status": "Status", - "contacts_agents_col_linked": "Linked", - "contacts_agents_revoke": "Revoke", "contacts_action_archive": "Archive", "contacts_agents_col_referrals": "Referrals", "contacts_agent_email_locked_hint": "An agent's email is their account key across companies, so it can't be changed here. To fix a typo or move to a new address, archive this agent and add a new one (report links already sent still work).", diff --git a/server/durable-objects/inspection-doc.ts b/server/durable-objects/inspection-doc.ts index 5763974ae..fe04ed520 100644 --- a/server/durable-objects/inspection-doc.ts +++ b/server/durable-objects/inspection-doc.ts @@ -239,7 +239,7 @@ export class InspectionDocDO extends DurableObject { // blockConcurrencyWhile suspends all incoming requests until the // Promise resolves, guaranteeing that a hibernation-reconstructed DO // always has the persisted state loaded before the first message. - ctx.blockConcurrencyWhile(() => this.hydrate()); + void ctx.blockConcurrencyWhile(() => this.hydrate()); // void: not awaitable in ctor; runtime gates on it internally // Relay doc updates to all connected sockets (except the originator) // and schedule a debounced persist. The handler is a STABLE bound method diff --git a/server/lib/validations/admin/compliance.ts b/server/lib/validations/admin/compliance.ts index 4cf605f2b..9e7067043 100644 --- a/server/lib/validations/admin/compliance.ts +++ b/server/lib/validations/admin/compliance.ts @@ -111,6 +111,7 @@ export const EraseDataResponseSchema = createApiResponseSchema(z.object({ export const TeamMembersResponseSchema = createApiResponseSchema(z.object({ members: z.array(z.object({ id: z.string().uuid().describe('TODO describe id field for the OpenInspection MCP integration'), + name: z.string().nullable().describe("The member's display name; null when never set (renders as 'Unnamed')."), email: z.string().describe('TODO describe email field for the OpenInspection MCP integration'), role: z.string().describe('TODO describe role field for the OpenInspection MCP integration'), createdAt: z.string().describe('TODO describe createdAt field for the OpenInspection MCP integration'), diff --git a/server/services/team.service.ts b/server/services/team.service.ts index fec6c7f6d..f66e6c8bf 100644 --- a/server/services/team.service.ts +++ b/server/services/team.service.ts @@ -67,6 +67,7 @@ export class TeamService { const [activeUsers, pendingInvites, tenantRecord] = await Promise.all([ db.select({ id: users.id, + name: users.name, email: users.email, role: users.role, createdAt: users.createdAt diff --git a/tests/unit/agent/magic-login.spec.ts b/tests/unit/agent/magic-login.spec.ts index b782fdbae..eca366b97 100644 --- a/tests/unit/agent/magic-login.spec.ts +++ b/tests/unit/agent/magic-login.spec.ts @@ -280,7 +280,7 @@ describe('Agent magic-login primitive', () => { * cookie) is deferred to the Task 8 E2E suite, which can drive the actual * worker entry (workers/app.ts) rather than a unit-level Hono app. */ -describe('Agent magic-login — jwtAuthMiddleware allowlist', { timeout: 30_000 }, () => { +describe('Agent magic-login — jwtAuthMiddleware allowlist', { timeout: 60_000 }, () => { it('bypasses JWT verification for both entry points regardless of a stale Bearer token', async () => { const { jwtAuthMiddleware } = await import('../../../server/index'); for (const path of ['/agent/magic-login', '/api/agent/magic-login/request']) { From ee18c27e54720f2baf8a51b48fcf1ca0c3ad2a76 Mon Sep 17 00:00:00 2001 From: important-new Date: Tue, 21 Jul 2026 18:48:36 +0800 Subject: [PATCH 15/15] chore(db): squash migrations into a single 0000_baseline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-launch policy (drizzle.config.ts): the schema is the single source of truth and forward migrations collapse into one baseline. Regenerated migrations/0000_baseline.sql from server/lib/db/schema after clearing the forward migrations + meta; migrations/data/ (severity-normalization data migration) is preserved. The fresh baseline drops user_identity_links (removed from the schema when the dormant M20 IdentitySwitcher was deleted) with no standalone drop migration — the squash omits it. Verified: 87/87 schema tables present (zero missing, zero orphans), db:check green (hand=87 == generated=87), wipe + fresh local apply clean (243 commands), worker boots and /login·/inspections·/book serve with no schema errors. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017YiCgWAmqyzpfs3pp1kjg3 --- migrations/0000_baseline.sql | 252 +- migrations/0001_boolean_columns_is_has.sql | 52 - migrations/0002_timezone_columns.sql | 2 - migrations/0003_fine_marrow.sql | 18 - migrations/0004_far_quicksilver.sql | 15 - migrations/0005_flaky_romulus.sql | 2 - migrations/0006_old_doomsday.sql | 14 - migrations/0007_large_exiles.sql | 3 - migrations/0008_swift_stryfe.sql | 1 - migrations/0009_aspiring_mathemanic.sql | 1 - migrations/0010_broad_bishop.sql | 3 - migrations/0011_light_stark_industries.sql | 6 - migrations/0012_minor_ares.sql | 13 - migrations/0013_futuristic_tyger_tiger.sql | 29 - migrations/0014_large_marvel_apes.sql | 90 - ...15_automations_recipient_discriminator.sql | 39 - migrations/0016_tiny_wrecker.sql | 1 - migrations/0017_ambiguous_stephen_strange.sql | 2 - migrations/0018_report_style_profiles.sql | 20 - migrations/0019_black_payback.sql | 15 - migrations/meta/0000_snapshot.json | 1303 +- migrations/meta/0001_snapshot.json | 9402 -------------- migrations/meta/0002_snapshot.json | 9417 -------------- migrations/meta/0003_snapshot.json | 9507 --------------- migrations/meta/0004_snapshot.json | 9605 --------------- migrations/meta/0005_snapshot.json | 9621 --------------- migrations/meta/0006_snapshot.json | 9713 --------------- migrations/meta/0007_snapshot.json | 9736 --------------- migrations/meta/0008_snapshot.json | 9744 --------------- migrations/meta/0009_snapshot.json | 9751 --------------- migrations/meta/0010_snapshot.json | 9772 --------------- migrations/meta/0011_snapshot.json | 9802 --------------- migrations/meta/0012_snapshot.json | 9885 --------------- migrations/meta/0013_snapshot.json | 10075 --------------- migrations/meta/0014_snapshot.json | 10005 --------------- migrations/meta/0015_snapshot.json | 10012 --------------- migrations/meta/0016_snapshot.json | 10019 --------------- migrations/meta/0017_snapshot.json | 10021 --------------- migrations/meta/0018_snapshot.json | 10042 --------------- migrations/meta/0019_snapshot.json | 10139 ---------------- migrations/meta/_journal.json | 135 +- 41 files changed, 1159 insertions(+), 187125 deletions(-) delete mode 100644 migrations/0001_boolean_columns_is_has.sql delete mode 100644 migrations/0002_timezone_columns.sql delete mode 100644 migrations/0003_fine_marrow.sql delete mode 100644 migrations/0004_far_quicksilver.sql delete mode 100644 migrations/0005_flaky_romulus.sql delete mode 100644 migrations/0006_old_doomsday.sql delete mode 100644 migrations/0007_large_exiles.sql delete mode 100644 migrations/0008_swift_stryfe.sql delete mode 100644 migrations/0009_aspiring_mathemanic.sql delete mode 100644 migrations/0010_broad_bishop.sql delete mode 100644 migrations/0011_light_stark_industries.sql delete mode 100644 migrations/0012_minor_ares.sql delete mode 100644 migrations/0013_futuristic_tyger_tiger.sql delete mode 100644 migrations/0014_large_marvel_apes.sql delete mode 100644 migrations/0015_automations_recipient_discriminator.sql delete mode 100644 migrations/0016_tiny_wrecker.sql delete mode 100644 migrations/0017_ambiguous_stephen_strange.sql delete mode 100644 migrations/0018_report_style_profiles.sql delete mode 100644 migrations/0019_black_payback.sql delete mode 100644 migrations/meta/0001_snapshot.json delete mode 100644 migrations/meta/0002_snapshot.json delete mode 100644 migrations/meta/0003_snapshot.json delete mode 100644 migrations/meta/0004_snapshot.json delete mode 100644 migrations/meta/0005_snapshot.json delete mode 100644 migrations/meta/0006_snapshot.json delete mode 100644 migrations/meta/0007_snapshot.json delete mode 100644 migrations/meta/0008_snapshot.json delete mode 100644 migrations/meta/0009_snapshot.json delete mode 100644 migrations/meta/0010_snapshot.json delete mode 100644 migrations/meta/0011_snapshot.json delete mode 100644 migrations/meta/0012_snapshot.json delete mode 100644 migrations/meta/0013_snapshot.json delete mode 100644 migrations/meta/0014_snapshot.json delete mode 100644 migrations/meta/0015_snapshot.json delete mode 100644 migrations/meta/0016_snapshot.json delete mode 100644 migrations/meta/0017_snapshot.json delete mode 100644 migrations/meta/0018_snapshot.json delete mode 100644 migrations/meta/0019_snapshot.json diff --git a/migrations/0000_baseline.sql b/migrations/0000_baseline.sql index 543509dae..f1f3f69e4 100644 --- a/migrations/0000_baseline.sql +++ b/migrations/0000_baseline.sql @@ -76,6 +76,7 @@ CREATE TABLE `automation_logs` ( `automation_id` text NOT NULL, `inspection_id` text NOT NULL, `recipient` text NOT NULL, + `recipient_role_key` text, `channel` text DEFAULT 'email' NOT NULL, `send_at` integer NOT NULL, `delivered_at` integer, @@ -87,13 +88,14 @@ CREATE TABLE `automation_logs` ( --> statement-breakpoint CREATE INDEX `idx_automation_logs_pending` ON `automation_logs` (`tenant_id`,`status`,`send_at`);--> statement-breakpoint CREATE INDEX `idx_automation_logs_insp` ON `automation_logs` (`inspection_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `uq_automation_logs_event` ON `automation_logs` (`automation_id`,`inspection_id`,`event_id`) WHERE event_id IS NOT NULL;--> statement-breakpoint +CREATE UNIQUE INDEX `uq_automation_logs_event` ON `automation_logs` (`automation_id`,`inspection_id`,`event_id`,`channel`,`recipient`) WHERE event_id IS NOT NULL;--> statement-breakpoint CREATE TABLE `automations` ( `id` text PRIMARY KEY NOT NULL, `tenant_id` text NOT NULL, `name` text NOT NULL, `trigger` text NOT NULL, - `recipient` text NOT NULL, + `recipient_kind` text NOT NULL, + `recipient_role_profile_id` text, `delay_minutes` integer DEFAULT 0 NOT NULL, `subject_template` text NOT NULL, `body_template` text NOT NULL, @@ -102,7 +104,7 @@ CREATE TABLE `automations` ( `channels` text DEFAULT '["email"]' NOT NULL, `sms_body` text, `sms_template_id` text, - `active` integer DEFAULT true NOT NULL, + `is_active` integer DEFAULT true NOT NULL, `is_default` integer DEFAULT false NOT NULL, `created_at` integer NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action @@ -132,12 +134,61 @@ CREATE TABLE `availability_overrides` ( `start_time` text, `end_time` text, `created_at` integer NOT NULL, + `source` text, + `external_id` text, + `transparency` text, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`inspector_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint CREATE INDEX `idx_avail_overrides_insp` ON `availability_overrides` (`inspector_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `idx_avail_overrides_block_unique` ON `availability_overrides` (`inspector_id`,`date`) WHERE is_available = 0;--> statement-breakpoint +CREATE UNIQUE INDEX `idx_avail_overrides_block_unique` ON `availability_overrides` (`inspector_id`,`date`) WHERE is_available = 0 AND source IS NULL;--> statement-breakpoint +CREATE UNIQUE INDEX `uq_avail_overrides_external` ON `availability_overrides` (`inspector_id`,`source`,`external_id`);--> statement-breakpoint +CREATE TABLE `calendar_blocks` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `user_id` text NOT NULL, + `title` text NOT NULL, + `date` text NOT NULL, + `start_time` text, + `end_time` text, + `is_all_day` integer DEFAULT false NOT NULL, + `notes` text, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); +--> statement-breakpoint +CREATE INDEX `idx_calendar_blocks_tenant_user_date` ON `calendar_blocks` (`tenant_id`,`user_id`,`date`);--> statement-breakpoint +CREATE TABLE `calendar_connection_read_calendars` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `connection_id` text NOT NULL, + `external_calendar_id` text NOT NULL, + `summary` text, + `access_role` text, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `uq_conn_read_cal` ON `calendar_connection_read_calendars` (`connection_id`,`external_calendar_id`);--> statement-breakpoint +CREATE INDEX `idx_conn_read_cal_tenant` ON `calendar_connection_read_calendars` (`tenant_id`,`connection_id`);--> statement-breakpoint +CREATE TABLE `calendar_connections` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `user_id` text NOT NULL, + `provider` text NOT NULL, + `auth_type` text NOT NULL, + `credentials_enc` text NOT NULL, + `credentials_dek_enc` text NOT NULL, + `capabilities` text NOT NULL, + `calendar_id` text NOT NULL, + `connected_at` integer NOT NULL, + `updated_at` integer NOT NULL, + `last_sync_at` integer +); +--> statement-breakpoint +CREATE UNIQUE INDEX `uq_calendar_connections_user_provider` ON `calendar_connections` (`user_id`,`provider`);--> statement-breakpoint +CREATE INDEX `idx_calendar_connections_tenant_user` ON `calendar_connections` (`tenant_id`,`user_id`);--> statement-breakpoint CREATE TABLE `comment_usage` ( `tenant_id` text NOT NULL, `user_id` text NOT NULL, @@ -180,7 +231,7 @@ CREATE TABLE `commercial_subtypes` ( `name` text NOT NULL, `based_on` text, `description` text, - `disabled` integer DEFAULT false NOT NULL, + `is_disabled` integer DEFAULT false NOT NULL, `created_at` integer NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action ); @@ -200,6 +251,23 @@ CREATE TABLE `concierge_confirm_tokens` ( --> statement-breakpoint CREATE INDEX `idx_concierge_tokens_expiry` ON `concierge_confirm_tokens` (`expires_at`);--> statement-breakpoint CREATE UNIQUE INDEX `idx_concierge_confirm_token_hash` ON `concierge_confirm_tokens` (`token_hash`);--> statement-breakpoint +CREATE TABLE `contact_role_profiles` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `key` text NOT NULL, + `label` text NOT NULL, + `kind` text NOT NULL, + `email_template_id` text, + `sms_template_id` text, + `is_system` integer DEFAULT false NOT NULL, + `sort_order` integer DEFAULT 0 NOT NULL, + `is_active` integer DEFAULT true NOT NULL, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); +--> statement-breakpoint +CREATE INDEX `idx_crp_tenant` ON `contact_role_profiles` (`tenant_id`);--> statement-breakpoint +CREATE UNIQUE INDEX `uq_crp_tenant_key` ON `contact_role_profiles` (`tenant_id`,`key`) WHERE is_active = 1;--> statement-breakpoint CREATE TABLE `contacts` ( `id` text PRIMARY KEY NOT NULL, `tenant_id` text NOT NULL, @@ -262,7 +330,7 @@ CREATE TABLE `defect_categories` ( `tenant_id` text NOT NULL, `name` text NOT NULL, `color` text DEFAULT '#6b7280' NOT NULL, - `drives_summary` integer DEFAULT true NOT NULL, + `is_summary_driver` integer DEFAULT true NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `is_seed` integer DEFAULT false NOT NULL, `created_at` integer NOT NULL @@ -278,7 +346,7 @@ CREATE TABLE `discount_codes` ( `max_uses` integer, `uses_count` integer DEFAULT 0 NOT NULL, `expires_at` integer, - `active` integer DEFAULT true NOT NULL, + `is_active` integer DEFAULT true NOT NULL, `created_at` integer NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action ); @@ -291,10 +359,10 @@ CREATE TABLE `document_review_items` ( `inspection_id` text NOT NULL, `document_key` text NOT NULL, `label` text NOT NULL, - `requested` integer DEFAULT false NOT NULL, - `received` integer DEFAULT false NOT NULL, - `reviewed` integer DEFAULT false NOT NULL, - `na` integer DEFAULT false NOT NULL, + `is_requested` integer DEFAULT false NOT NULL, + `is_received` integer DEFAULT false NOT NULL, + `is_reviewed` integer DEFAULT false NOT NULL, + `is_na` integer DEFAULT false NOT NULL, `notes` text, `sort_order` integer DEFAULT 0 NOT NULL ); @@ -352,7 +420,7 @@ CREATE TABLE `event_types` ( `default_price_cents` integer DEFAULT 0 NOT NULL, `color` text DEFAULT '#6366f1' NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, - `active` integer DEFAULT true NOT NULL, + `is_active` integer DEFAULT true NOT NULL, `created_at` integer NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action ); @@ -460,6 +528,18 @@ CREATE TABLE `inspection_messages` ( --> statement-breakpoint CREATE INDEX `idx_msg_inspection` ON `inspection_messages` (`inspection_id`,`created_at`);--> statement-breakpoint CREATE INDEX `idx_msg_unread` ON `inspection_messages` (`tenant_id`,`inspection_id`,`from_role`) WHERE "inspection_messages"."read_at" IS NULL;--> statement-breakpoint +CREATE TABLE `inspection_people` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `inspection_id` text NOT NULL, + `contact_id` text NOT NULL, + `role_profile_id` text NOT NULL, + `created_at` integer NOT NULL +); +--> statement-breakpoint +CREATE INDEX `idx_ip_inspection` ON `inspection_people` (`inspection_id`);--> statement-breakpoint +CREATE INDEX `idx_ip_tenant` ON `inspection_people` (`tenant_id`);--> statement-breakpoint +CREATE UNIQUE INDEX `uq_ip_insp_contact_role` ON `inspection_people` (`inspection_id`,`contact_id`,`role_profile_id`);--> statement-breakpoint CREATE TABLE `inspection_requests` ( `id` text PRIMARY KEY NOT NULL, `tenant_id` text NOT NULL, @@ -519,7 +599,7 @@ CREATE TABLE `inspection_types` ( `name` text NOT NULL, `based_on` text, `description` text, - `enabled` integer DEFAULT true NOT NULL, + `is_enabled` integer DEFAULT true NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `created_at` integer NOT NULL ); @@ -554,24 +634,19 @@ CREATE TABLE `inspections` ( `address_lat` real, `address_lng` real, `address_geocoded_at` integer, - `client_contact_id` text, - `client_name` text, - `client_email` text, - `client_phone` text, `template_id` text, `date` text NOT NULL, `status` text DEFAULT 'requested' NOT NULL, `report_status` text DEFAULT 'in_progress' NOT NULL, `payment_status` text DEFAULT 'unpaid' NOT NULL, - `referred_by_agent_id` text, `price_cents` integer DEFAULT 0 NOT NULL, `created_at` integer NOT NULL, `confirmed_at` integer, `cancel_reason` text, `cancel_notes` text, - `payment_required` integer DEFAULT false NOT NULL, - `agreement_required` integer DEFAULT false NOT NULL, - `auto_sign_on_publish` integer DEFAULT false NOT NULL, + `is_payment_required` integer DEFAULT false NOT NULL, + `is_agreement_required` integer DEFAULT false NOT NULL, + `is_auto_sign_on_publish` integer DEFAULT false NOT NULL, `discount_code_id` text, `discount_amount_cents` integer, `closing_date` text, @@ -593,15 +668,14 @@ CREATE TABLE `inspections` ( `commercial_subtype` text, `report_tier` text, `county` text, - `selling_agent_id` text, - `disable_automations` integer DEFAULT false NOT NULL, + `is_automations_disabled` integer DEFAULT false NOT NULL, `template_snapshot` text, `template_snapshot_version` integer DEFAULT 1, - `report_theme_override` text, + `profile_override` text, `require_defect_fields_override` text, `request_id` text, `concierge_status` text, - `team_mode` integer DEFAULT false NOT NULL, + `is_team_mode` integer DEFAULT false NOT NULL, `lead_inspector_id` text, `helper_inspector_ids` text DEFAULT '[]' NOT NULL, `data_version` integer DEFAULT 0 NOT NULL, @@ -614,23 +688,40 @@ CREATE TABLE `inspections` ( `pca_narrative` text, `deviations` text, `report_photo_mode` text, + `scheduled_start_ms` integer, + `scheduled_end_ms` integer, + `duration_min` integer, + `badge_layout_override` text, + `report_photo_columns` integer, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`inspector_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`template_id`) REFERENCES `templates`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`discount_code_id`) REFERENCES `discount_codes`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`selling_agent_id`) REFERENCES `contacts`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`request_id`) REFERENCES `inspection_requests`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint CREATE INDEX `idx_inspections_tenant` ON `inspections` (`tenant_id`);--> statement-breakpoint CREATE INDEX `idx_inspections_request` ON `inspections` (`request_id`);--> statement-breakpoint CREATE INDEX `idx_inspections_inspector` ON `inspections` (`inspector_id`);--> statement-breakpoint -CREATE INDEX `idx_inspections_agent` ON `inspections` (`referred_by_agent_id`);--> statement-breakpoint CREATE INDEX `idx_inspections_tenant_status` ON `inspections` (`tenant_id`,`status`);--> statement-breakpoint CREATE INDEX `idx_inspections_tenant_date` ON `inspections` (`tenant_id`,`date`);--> statement-breakpoint -CREATE INDEX `idx_inspections_tenant_client_email` ON `inspections` (`tenant_id`,`client_email`);--> statement-breakpoint CREATE INDEX `idx_inspections_inspector_date` ON `inspections` (`inspector_id`,`date`);--> statement-breakpoint CREATE INDEX `idx_inspections_root` ON `inspections` (`root_inspection_id`);--> statement-breakpoint +CREATE TABLE `inspector_credentials` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `user_id` text NOT NULL, + `label` text NOT NULL, + `member_number` text, + `image_r2_key` text, + `sort_order` integer DEFAULT 0 NOT NULL, + `is_active` integer DEFAULT true NOT NULL, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); +--> statement-breakpoint +CREATE INDEX `idx_inspector_credentials_tenant` ON `inspector_credentials` (`tenant_id`);--> statement-breakpoint +CREATE INDEX `idx_inspector_credentials_user` ON `inspector_credentials` (`user_id`);--> statement-breakpoint CREATE TABLE `invoices` ( `id` text PRIMARY KEY NOT NULL, `tenant_id` text NOT NULL, @@ -649,6 +740,7 @@ CREATE TABLE `invoices` ( `voided_at` integer, `qbo_sync_status` text, `created_at` integer NOT NULL, + `currency` text DEFAULT 'USD' NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`inspection_id`) REFERENCES `inspections`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`contact_id`) REFERENCES `contacts`(`id`) ON UPDATE no action ON DELETE no action @@ -666,12 +758,12 @@ CREATE TABLE `marketplace_libraries` ( `author_id` text DEFAULT 'system' NOT NULL, `changelog` text, `download_count` integer DEFAULT 0 NOT NULL, - `featured` integer DEFAULT false NOT NULL, + `is_featured` integer DEFAULT false NOT NULL, `created_at` integer NOT NULL, `updated_at` integer NOT NULL ); --> statement-breakpoint -CREATE INDEX `idx_marketplace_libraries_kind_featured` ON `marketplace_libraries` (`kind`,`featured`);--> statement-breakpoint +CREATE INDEX `idx_marketplace_libraries_kind_featured` ON `marketplace_libraries` (`kind`,`is_featured`);--> statement-breakpoint CREATE TABLE `marketplace_templates` ( `id` text PRIMARY KEY NOT NULL, `name` text NOT NULL, @@ -681,7 +773,7 @@ CREATE TABLE `marketplace_templates` ( `author_id` text DEFAULT 'system' NOT NULL, `changelog` text, `download_count` integer DEFAULT 0 NOT NULL, - `featured` integer DEFAULT false NOT NULL, + `is_featured` integer DEFAULT false NOT NULL, `created_at` integer NOT NULL, `updated_at` integer NOT NULL ); @@ -717,7 +809,7 @@ CREATE TABLE `messaging_compliance` ( `provider_meta` text, `provisioned_number` text, `provisioned_number_sid` text, - `sender_attached` integer DEFAULT false NOT NULL, + `has_sender_attached` integer DEFAULT false NOT NULL, `compliance_status` text DEFAULT 'not_started' NOT NULL, `rejection_reason` text, `last_sync_at` integer, @@ -779,7 +871,7 @@ CREATE TABLE `qbo_connections` ( `token_expires_at` integer NOT NULL, `refresh_token_expires_at` integer NOT NULL, `last_sync_at` integer, - `sync_enabled` integer DEFAULT true NOT NULL, + `is_sync_enabled` integer DEFAULT true NOT NULL, `default_item_id` text DEFAULT '1' NOT NULL, `created_at` integer NOT NULL ); @@ -805,7 +897,7 @@ CREATE TABLE `qbo_sync_errors` ( `error_code` text NOT NULL, `error_msg` text NOT NULL, `retries` integer DEFAULT 0 NOT NULL, - `resolved` integer DEFAULT false NOT NULL, + `is_resolved` integer DEFAULT false NOT NULL, `created_at` integer NOT NULL, `updated_at` integer NOT NULL ); @@ -899,7 +991,7 @@ CREATE TABLE `report_signoff` ( `qualifications_ref` text, `signed_at` integer NOT NULL, `signature_ref` text NOT NULL, - `dual_role` integer DEFAULT false NOT NULL + `is_dual_role` integer DEFAULT false NOT NULL ); --> statement-breakpoint CREATE INDEX `idx_report_signoff_inspection` ON `report_signoff` (`tenant_id`,`inspection_id`);--> statement-breakpoint @@ -943,7 +1035,7 @@ CREATE TABLE `services` ( `duration_minutes` integer, `template_id` text, `agreement_id` text, - `active` integer DEFAULT true NOT NULL, + `is_active` integer DEFAULT true NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `created_at` integer NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action, @@ -1016,12 +1108,24 @@ CREATE TABLE `templates` ( `property_type` text, `commercial_subtype` text, `description` text, - `featured` integer DEFAULT false NOT NULL, + `is_featured` integer DEFAULT false NOT NULL, + `default_profile_id` text, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint CREATE INDEX `idx_templates_tenant` ON `templates` (`tenant_id`);--> statement-breakpoint CREATE INDEX `idx_templates_rating_system` ON `templates` (`rating_system_id`);--> statement-breakpoint +CREATE TABLE `tenant_custom_holidays` ( + `id` text PRIMARY KEY NOT NULL, + `tenant_id` text NOT NULL, + `date` text NOT NULL, + `name` text NOT NULL, + `created_at` integer NOT NULL, + `updated_at` integer NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `uq_tenant_custom_holidays_tenant_date` ON `tenant_custom_holidays` (`tenant_id`,`date`);--> statement-breakpoint +CREATE INDEX `idx_tenant_custom_holidays_tenant_date` ON `tenant_custom_holidays` (`tenant_id`,`date`);--> statement-breakpoint CREATE TABLE `tenant_library_imports` ( `id` text PRIMARY KEY NOT NULL, `tenant_id` text NOT NULL, @@ -1073,24 +1177,12 @@ CREATE TABLE `usage_counters` ( ); --> statement-breakpoint CREATE INDEX `idx_usage_counters_tenant` ON `usage_counters` (`tenant_id`);--> statement-breakpoint -CREATE TABLE `user_identity_links` ( - `id` text PRIMARY KEY NOT NULL, - `primary_user_id` text NOT NULL, - `linked_user_id` text NOT NULL, - `linked_tenant_id` text NOT NULL, - `linked_role` text NOT NULL, - `linked_display_name` text NOT NULL, - `created_at` integer DEFAULT (unixepoch() * 1000) NOT NULL -); ---> statement-breakpoint -CREATE INDEX `idx_user_identity_links_primary` ON `user_identity_links` (`primary_user_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `uq_user_identity_links_primary_linked` ON `user_identity_links` (`primary_user_id`,`linked_user_id`);--> statement-breakpoint CREATE TABLE `email_templates` ( `tenant_id` text NOT NULL, `trigger` text NOT NULL, `subject` text, `blocks` text, - `enabled` integer DEFAULT true NOT NULL, + `is_enabled` integer DEFAULT true NOT NULL, `updated_at` integer NOT NULL, PRIMARY KEY(`tenant_id`, `trigger`), FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action @@ -1103,9 +1195,9 @@ CREATE TABLE `tenant_configs` ( `logo_url` text, `support_email` text, `company_address` text, - `pdf_show_footer` integer DEFAULT true NOT NULL, - `pdf_show_page_numbers` integer DEFAULT true NOT NULL, - `pdf_show_license` integer DEFAULT true NOT NULL, + `is_pdf_footer_shown` integer DEFAULT true NOT NULL, + `is_pdf_page_numbers_shown` integer DEFAULT true NOT NULL, + `is_pdf_license_shown` integer DEFAULT true NOT NULL, `sender_email` text, `reply_to` text, `email_mode` text DEFAULT 'platform' NOT NULL, @@ -1121,34 +1213,42 @@ CREATE TABLE `tenant_configs` ( `dek_enc` text, `ics_token` text, `widget_allowed_origins` text, - `report_theme` text DEFAULT 'modern' NOT NULL, + `default_profile_id` text DEFAULT 'signature' NOT NULL, `attention_thresholds` text DEFAULT '{"agreement_unsigned_h":72,"invoice_overdue_h":72,"report_unpublished_h":72}' NOT NULL, `inspection_prefs` text, - `show_estimates` integer DEFAULT false NOT NULL, - `enable_repair_list` integer DEFAULT false NOT NULL, - `enable_customer_repair_export` integer DEFAULT false NOT NULL, - `block_unpaid` integer DEFAULT false NOT NULL, - `block_unsigned_agreement` integer DEFAULT false NOT NULL, + `is_estimates_shown` integer DEFAULT false NOT NULL, + `is_repair_list_enabled` integer DEFAULT false NOT NULL, + `is_customer_repair_export_enabled` integer DEFAULT false NOT NULL, + `is_unpaid_blocked` integer DEFAULT false NOT NULL, + `is_unsigned_agreement_blocked` integer DEFAULT false NOT NULL, `custom_referral_sources` text, `dashboard_column_prefs` text, - `concierge_review_required` integer DEFAULT false NOT NULL, - `allow_inspector_choice` integer DEFAULT false NOT NULL, - `enable_pdf_pipeline` integer DEFAULT false NOT NULL, - `team_mode_default` integer DEFAULT false NOT NULL, - `apprentice_review_required` integer DEFAULT false NOT NULL, - `guest_invites_enabled` integer DEFAULT true NOT NULL, + `is_concierge_review_required` integer DEFAULT false NOT NULL, + `is_inspector_choice_allowed` integer DEFAULT false NOT NULL, + `is_pdf_pipeline_enabled` integer DEFAULT false NOT NULL, + `is_team_mode_default` integer DEFAULT false NOT NULL, + `is_apprentice_review_required` integer DEFAULT false NOT NULL, + `is_guest_invites_enabled` integer DEFAULT true NOT NULL, `require_defect_fields` text DEFAULT 'none' NOT NULL, `agreement_retention_years` integer DEFAULT 6 NOT NULL, `reinspection_statuses` text, - `collab_editing` integer DEFAULT true NOT NULL, + `is_collab_editing_enabled` integer DEFAULT true NOT NULL, `updated_at` integer NOT NULL, `sms_byo_provider` text, `email_byo_provider` text DEFAULT 'resend' NOT NULL, - `managed_eligible` integer DEFAULT false NOT NULL, + `is_managed_eligible` integer DEFAULT false NOT NULL, `managed_provider` text DEFAULT 'twilio' NOT NULL, - `reserve_schedule_enabled` integer DEFAULT false NOT NULL, + `is_reserve_schedule_enabled` integer DEFAULT false NOT NULL, `reserve_term_years` integer DEFAULT 12 NOT NULL, `inflation_rate_bps` integer, + `default_timezone` text DEFAULT 'UTC' NOT NULL, + `booking_slot_mode` text DEFAULT 'fixed' NOT NULL, + `booking_slot_interval_min` integer DEFAULT 30 NOT NULL, + `holiday_region` text, + `holiday_public_policy` text DEFAULT 'open' NOT NULL, + `holiday_internal_policy` text DEFAULT 'advisory' NOT NULL, + `default_locale` text DEFAULT 'en-US' NOT NULL, + `currency` text DEFAULT 'USD' NOT NULL, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint @@ -1208,20 +1308,18 @@ CREATE TABLE `users` ( `license_number` text, `photo_url` text, `default_signature_base64` text, - `signature_enabled` integer DEFAULT true NOT NULL, + `is_signature_enabled` integer DEFAULT true NOT NULL, `slug` text, `role` text DEFAULT 'manager' NOT NULL, - `google_refresh_token` text, - `google_calendar_id` text, `onboarding_state` text, `created_at` integer NOT NULL, `totp_secret` text, - `totp_enabled` integer DEFAULT false NOT NULL, + `is_totp_enabled` integer DEFAULT false NOT NULL, `totp_recovery_codes` text, `totp_verified_at` integer, - `notify_on_referral` integer DEFAULT true NOT NULL, - `notify_on_report` integer DEFAULT true NOT NULL, - `notify_on_paid` integer DEFAULT false NOT NULL, + `is_referral_notification_enabled` integer DEFAULT true NOT NULL, + `is_report_notification_enabled` integer DEFAULT true NOT NULL, + `is_paid_notification_enabled` integer DEFAULT false NOT NULL, `last_active_at` integer, `mentor_id` text, `assigned_section_ids` text DEFAULT '[]' NOT NULL, @@ -1229,6 +1327,8 @@ CREATE TABLE `users` ( `deleted_at` integer, `terms_accepted` text, `permission_overrides` text, + `timezone` text, + `locale` text, FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint @@ -1274,7 +1374,7 @@ CREATE TABLE `integration_test_results` ( `tenant_id` text NOT NULL, `target` text NOT NULL, `provider` text, - `ok` integer NOT NULL, + `is_ok` integer NOT NULL, `detail` text, `tested_by_user_id` text, `tested_at` integer NOT NULL diff --git a/migrations/0001_boolean_columns_is_has.sql b/migrations/0001_boolean_columns_is_has.sql deleted file mode 100644 index 296df183f..000000000 --- a/migrations/0001_boolean_columns_is_has.sql +++ /dev/null @@ -1,52 +0,0 @@ --- Boolean column naming normalization (#227): every boolean SQL column is --- renamed to the is_/has_ predicate convention. Data-preserving native SQLite --- RENAME COLUMN (no table rebuild, no FK-drop risk on D1). The Drizzle JS --- property names are unchanged, so no consumer code moves with this migration. --- Old→new map: docs/superpowers/notes/2026-07-14-oi-boolean-rename-map.md -ALTER TABLE `commercial_subtypes` RENAME COLUMN `disabled` TO `is_disabled`; -ALTER TABLE `messaging_compliance` RENAME COLUMN `sender_attached` TO `has_sender_attached`; -ALTER TABLE `automations` RENAME COLUMN `active` TO `is_active`; -ALTER TABLE `event_types` RENAME COLUMN `active` TO `is_active`; -ALTER TABLE `inspection_types` RENAME COLUMN `enabled` TO `is_enabled`; -ALTER TABLE `inspections` RENAME COLUMN `payment_required` TO `is_payment_required`; -ALTER TABLE `inspections` RENAME COLUMN `agreement_required` TO `is_agreement_required`; -ALTER TABLE `inspections` RENAME COLUMN `auto_sign_on_publish` TO `is_auto_sign_on_publish`; -ALTER TABLE `inspections` RENAME COLUMN `disable_automations` TO `is_automations_disabled`; -ALTER TABLE `inspections` RENAME COLUMN `team_mode` TO `is_team_mode`; -ALTER TABLE `defect_categories` RENAME COLUMN `drives_summary` TO `is_summary_driver`; -ALTER TABLE `services` RENAME COLUMN `active` TO `is_active`; -ALTER TABLE `discount_codes` RENAME COLUMN `active` TO `is_active`; -ALTER TABLE `templates` RENAME COLUMN `featured` TO `is_featured`; -ALTER TABLE `marketplace_templates` RENAME COLUMN `featured` TO `is_featured`; -ALTER TABLE `marketplace_libraries` RENAME COLUMN `featured` TO `is_featured`; -ALTER TABLE `report_signoff` RENAME COLUMN `dual_role` TO `is_dual_role`; -ALTER TABLE `document_review_items` RENAME COLUMN `requested` TO `is_requested`; -ALTER TABLE `document_review_items` RENAME COLUMN `received` TO `is_received`; -ALTER TABLE `document_review_items` RENAME COLUMN `reviewed` TO `is_reviewed`; -ALTER TABLE `document_review_items` RENAME COLUMN `na` TO `is_na`; -ALTER TABLE `qbo_connections` RENAME COLUMN `sync_enabled` TO `is_sync_enabled`; -ALTER TABLE `qbo_sync_errors` RENAME COLUMN `resolved` TO `is_resolved`; -ALTER TABLE `tenant_configs` RENAME COLUMN `pdf_show_footer` TO `is_pdf_footer_shown`; -ALTER TABLE `tenant_configs` RENAME COLUMN `pdf_show_page_numbers` TO `is_pdf_page_numbers_shown`; -ALTER TABLE `tenant_configs` RENAME COLUMN `pdf_show_license` TO `is_pdf_license_shown`; -ALTER TABLE `tenant_configs` RENAME COLUMN `show_estimates` TO `is_estimates_shown`; -ALTER TABLE `tenant_configs` RENAME COLUMN `enable_repair_list` TO `is_repair_list_enabled`; -ALTER TABLE `tenant_configs` RENAME COLUMN `enable_customer_repair_export` TO `is_customer_repair_export_enabled`; -ALTER TABLE `tenant_configs` RENAME COLUMN `block_unpaid` TO `is_unpaid_blocked`; -ALTER TABLE `tenant_configs` RENAME COLUMN `block_unsigned_agreement` TO `is_unsigned_agreement_blocked`; -ALTER TABLE `tenant_configs` RENAME COLUMN `concierge_review_required` TO `is_concierge_review_required`; -ALTER TABLE `tenant_configs` RENAME COLUMN `allow_inspector_choice` TO `is_inspector_choice_allowed`; -ALTER TABLE `tenant_configs` RENAME COLUMN `enable_pdf_pipeline` TO `is_pdf_pipeline_enabled`; -ALTER TABLE `tenant_configs` RENAME COLUMN `team_mode_default` TO `is_team_mode_default`; -ALTER TABLE `tenant_configs` RENAME COLUMN `apprentice_review_required` TO `is_apprentice_review_required`; -ALTER TABLE `tenant_configs` RENAME COLUMN `guest_invites_enabled` TO `is_guest_invites_enabled`; -ALTER TABLE `tenant_configs` RENAME COLUMN `collab_editing` TO `is_collab_editing_enabled`; -ALTER TABLE `tenant_configs` RENAME COLUMN `managed_eligible` TO `is_managed_eligible`; -ALTER TABLE `tenant_configs` RENAME COLUMN `reserve_schedule_enabled` TO `is_reserve_schedule_enabled`; -ALTER TABLE `email_templates` RENAME COLUMN `enabled` TO `is_enabled`; -ALTER TABLE `integration_test_results` RENAME COLUMN `ok` TO `is_ok`; -ALTER TABLE `users` RENAME COLUMN `signature_enabled` TO `is_signature_enabled`; -ALTER TABLE `users` RENAME COLUMN `totp_enabled` TO `is_totp_enabled`; -ALTER TABLE `users` RENAME COLUMN `notify_on_referral` TO `is_referral_notification_enabled`; -ALTER TABLE `users` RENAME COLUMN `notify_on_report` TO `is_report_notification_enabled`; -ALTER TABLE `users` RENAME COLUMN `notify_on_paid` TO `is_paid_notification_enabled`; diff --git a/migrations/0002_timezone_columns.sql b/migrations/0002_timezone_columns.sql deleted file mode 100644 index 9ec587959..000000000 --- a/migrations/0002_timezone_columns.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `tenant_configs` ADD `default_timezone` text DEFAULT 'UTC' NOT NULL;--> statement-breakpoint -ALTER TABLE `users` ADD `timezone` text; \ No newline at end of file diff --git a/migrations/0003_fine_marrow.sql b/migrations/0003_fine_marrow.sql deleted file mode 100644 index 7dae89a2b..000000000 --- a/migrations/0003_fine_marrow.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE `calendar_connections` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `user_id` text NOT NULL, - `provider` text NOT NULL, - `auth_type` text NOT NULL, - `credentials_enc` text NOT NULL, - `credentials_dek_enc` text NOT NULL, - `capabilities` text NOT NULL, - `calendar_id` text NOT NULL, - `connected_at` integer NOT NULL, - `updated_at` integer NOT NULL -); ---> statement-breakpoint -CREATE UNIQUE INDEX `uq_calendar_connections_user_provider` ON `calendar_connections` (`user_id`,`provider`);--> statement-breakpoint -CREATE INDEX `idx_calendar_connections_tenant_user` ON `calendar_connections` (`tenant_id`,`user_id`);--> statement-breakpoint -ALTER TABLE `users` DROP COLUMN `google_refresh_token`;--> statement-breakpoint -ALTER TABLE `users` DROP COLUMN `google_calendar_id`; \ No newline at end of file diff --git a/migrations/0004_far_quicksilver.sql b/migrations/0004_far_quicksilver.sql deleted file mode 100644 index 1bad02818..000000000 --- a/migrations/0004_far_quicksilver.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE `calendar_blocks` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `user_id` text NOT NULL, - `title` text NOT NULL, - `date` text NOT NULL, - `start_time` text, - `end_time` text, - `is_all_day` integer DEFAULT false NOT NULL, - `notes` text, - `created_at` integer NOT NULL, - `updated_at` integer NOT NULL -); ---> statement-breakpoint -CREATE INDEX `idx_calendar_blocks_tenant_user_date` ON `calendar_blocks` (`tenant_id`,`user_id`,`date`); \ No newline at end of file diff --git a/migrations/0005_flaky_romulus.sql b/migrations/0005_flaky_romulus.sql deleted file mode 100644 index 44d7ff841..000000000 --- a/migrations/0005_flaky_romulus.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE `tenant_configs` ADD `booking_slot_mode` text DEFAULT 'fixed' NOT NULL;--> statement-breakpoint -ALTER TABLE `tenant_configs` ADD `booking_slot_interval_min` integer DEFAULT 30 NOT NULL; \ No newline at end of file diff --git a/migrations/0006_old_doomsday.sql b/migrations/0006_old_doomsday.sql deleted file mode 100644 index ea08a79db..000000000 --- a/migrations/0006_old_doomsday.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE `tenant_custom_holidays` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `date` text NOT NULL, - `name` text NOT NULL, - `created_at` integer NOT NULL, - `updated_at` integer NOT NULL -); ---> statement-breakpoint -CREATE UNIQUE INDEX `uq_tenant_custom_holidays_tenant_date` ON `tenant_custom_holidays` (`tenant_id`,`date`);--> statement-breakpoint -CREATE INDEX `idx_tenant_custom_holidays_tenant_date` ON `tenant_custom_holidays` (`tenant_id`,`date`);--> statement-breakpoint -ALTER TABLE `tenant_configs` ADD `holiday_region` text;--> statement-breakpoint -ALTER TABLE `tenant_configs` ADD `holiday_public_policy` text DEFAULT 'open' NOT NULL;--> statement-breakpoint -ALTER TABLE `tenant_configs` ADD `holiday_internal_policy` text DEFAULT 'advisory' NOT NULL; \ No newline at end of file diff --git a/migrations/0007_large_exiles.sql b/migrations/0007_large_exiles.sql deleted file mode 100644 index 8d2e0dc1c..000000000 --- a/migrations/0007_large_exiles.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE `tenant_configs` ADD `default_locale` text DEFAULT 'en-US' NOT NULL;--> statement-breakpoint -ALTER TABLE `tenant_configs` ADD `currency` text DEFAULT 'USD' NOT NULL;--> statement-breakpoint -ALTER TABLE `users` ADD `locale` text; \ No newline at end of file diff --git a/migrations/0008_swift_stryfe.sql b/migrations/0008_swift_stryfe.sql deleted file mode 100644 index cd986edf6..000000000 --- a/migrations/0008_swift_stryfe.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `invoices` ADD `currency` text DEFAULT 'USD' NOT NULL; \ No newline at end of file diff --git a/migrations/0009_aspiring_mathemanic.sql b/migrations/0009_aspiring_mathemanic.sql deleted file mode 100644 index 7e7d0acda..000000000 --- a/migrations/0009_aspiring_mathemanic.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `calendar_connections` ADD `last_sync_at` integer; \ No newline at end of file diff --git a/migrations/0010_broad_bishop.sql b/migrations/0010_broad_bishop.sql deleted file mode 100644 index f0dd3d008..000000000 --- a/migrations/0010_broad_bishop.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE `inspections` ADD `scheduled_start_ms` integer;--> statement-breakpoint -ALTER TABLE `inspections` ADD `scheduled_end_ms` integer;--> statement-breakpoint -ALTER TABLE `inspections` ADD `duration_min` integer; \ No newline at end of file diff --git a/migrations/0011_light_stark_industries.sql b/migrations/0011_light_stark_industries.sql deleted file mode 100644 index c876cdb1e..000000000 --- a/migrations/0011_light_stark_industries.sql +++ /dev/null @@ -1,6 +0,0 @@ -DROP INDEX `idx_avail_overrides_block_unique`;--> statement-breakpoint -ALTER TABLE `availability_overrides` ADD `source` text;--> statement-breakpoint -ALTER TABLE `availability_overrides` ADD `external_id` text;--> statement-breakpoint -ALTER TABLE `availability_overrides` ADD `transparency` text;--> statement-breakpoint -CREATE UNIQUE INDEX `uq_avail_overrides_external` ON `availability_overrides` (`inspector_id`,`source`,`external_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `idx_avail_overrides_block_unique` ON `availability_overrides` (`inspector_id`,`date`) WHERE is_available = 0 AND source IS NULL; \ No newline at end of file diff --git a/migrations/0012_minor_ares.sql b/migrations/0012_minor_ares.sql deleted file mode 100644 index d59590d50..000000000 --- a/migrations/0012_minor_ares.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE `calendar_connection_read_calendars` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `connection_id` text NOT NULL, - `external_calendar_id` text NOT NULL, - `summary` text, - `access_role` text, - `created_at` integer NOT NULL, - `updated_at` integer NOT NULL -); ---> statement-breakpoint -CREATE UNIQUE INDEX `uq_conn_read_cal` ON `calendar_connection_read_calendars` (`connection_id`,`external_calendar_id`);--> statement-breakpoint -CREATE INDEX `idx_conn_read_cal_tenant` ON `calendar_connection_read_calendars` (`tenant_id`,`connection_id`); \ No newline at end of file diff --git a/migrations/0013_futuristic_tyger_tiger.sql b/migrations/0013_futuristic_tyger_tiger.sql deleted file mode 100644 index d421edeaf..000000000 --- a/migrations/0013_futuristic_tyger_tiger.sql +++ /dev/null @@ -1,29 +0,0 @@ -CREATE TABLE `contact_role_profiles` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `key` text NOT NULL, - `label` text NOT NULL, - `kind` text NOT NULL, - `email_template_id` text, - `sms_template_id` text, - `is_system` integer DEFAULT false NOT NULL, - `sort_order` integer DEFAULT 0 NOT NULL, - `is_active` integer DEFAULT true NOT NULL, - `created_at` integer NOT NULL, - `updated_at` integer NOT NULL -); ---> statement-breakpoint -CREATE INDEX `idx_crp_tenant` ON `contact_role_profiles` (`tenant_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `uq_crp_tenant_key` ON `contact_role_profiles` (`tenant_id`,`key`) WHERE is_active = 1;--> statement-breakpoint -CREATE TABLE `inspection_people` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `inspection_id` text NOT NULL, - `contact_id` text NOT NULL, - `role_profile_id` text NOT NULL, - `created_at` integer NOT NULL -); ---> statement-breakpoint -CREATE INDEX `idx_ip_inspection` ON `inspection_people` (`inspection_id`);--> statement-breakpoint -CREATE INDEX `idx_ip_tenant` ON `inspection_people` (`tenant_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `uq_ip_insp_contact_role` ON `inspection_people` (`inspection_id`,`contact_id`,`role_profile_id`); \ No newline at end of file diff --git a/migrations/0014_large_marvel_apes.sql b/migrations/0014_large_marvel_apes.sql deleted file mode 100644 index 4e6611823..000000000 --- a/migrations/0014_large_marvel_apes.sql +++ /dev/null @@ -1,90 +0,0 @@ -PRAGMA foreign_keys=OFF;--> statement-breakpoint -CREATE TABLE `__new_inspections` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `inspector_id` text, - `property_address` text NOT NULL, - `address_place_id` text, - `address_street` text, - `address_city` text, - `address_state` text, - `address_zip` text, - `address_county` text, - `address_lat` real, - `address_lng` real, - `address_geocoded_at` integer, - `template_id` text, - `date` text NOT NULL, - `status` text DEFAULT 'requested' NOT NULL, - `report_status` text DEFAULT 'in_progress' NOT NULL, - `payment_status` text DEFAULT 'unpaid' NOT NULL, - `price_cents` integer DEFAULT 0 NOT NULL, - `created_at` integer NOT NULL, - `confirmed_at` integer, - `cancel_reason` text, - `cancel_notes` text, - `is_payment_required` integer DEFAULT false NOT NULL, - `is_agreement_required` integer DEFAULT false NOT NULL, - `is_auto_sign_on_publish` integer DEFAULT false NOT NULL, - `discount_code_id` text, - `discount_amount_cents` integer, - `closing_date` text, - `referral_source` text, - `reference_number` text, - `internal_notes` text, - `year_built` integer, - `sqft` integer, - `foundation_type` text, - `bedrooms` integer, - `bathrooms` real, - `lot_size` text, - `property_facts` text, - `cover_photo_id` text, - `cover_crop` text, - `cover_image_key` text, - `unit` text, - `property_type` text, - `commercial_subtype` text, - `report_tier` text, - `county` text, - `is_automations_disabled` integer DEFAULT false NOT NULL, - `template_snapshot` text, - `template_snapshot_version` integer DEFAULT 1, - `report_theme_override` text, - `require_defect_fields_override` text, - `request_id` text, - `concierge_status` text, - `is_team_mode` integer DEFAULT false NOT NULL, - `lead_inspector_id` text, - `helper_inspector_ids` text DEFAULT '[]' NOT NULL, - `data_version` integer DEFAULT 0 NOT NULL, - `source_inspection_id` text, - `root_inspection_id` text, - `reinspection_round` integer, - `unit_inspection_mode` text DEFAULT 'tagged' NOT NULL, - `location_options` text, - `sampling_declaration` text, - `pca_narrative` text, - `deviations` text, - `report_photo_mode` text, - `scheduled_start_ms` integer, - `scheduled_end_ms` integer, - `duration_min` integer, - FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`inspector_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`template_id`) REFERENCES `templates`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`discount_code_id`) REFERENCES `discount_codes`(`id`) ON UPDATE no action ON DELETE no action, - FOREIGN KEY (`request_id`) REFERENCES `inspection_requests`(`id`) ON UPDATE no action ON DELETE no action -); ---> statement-breakpoint -INSERT INTO `__new_inspections`("id", "tenant_id", "inspector_id", "property_address", "address_place_id", "address_street", "address_city", "address_state", "address_zip", "address_county", "address_lat", "address_lng", "address_geocoded_at", "template_id", "date", "status", "report_status", "payment_status", "price_cents", "created_at", "confirmed_at", "cancel_reason", "cancel_notes", "is_payment_required", "is_agreement_required", "is_auto_sign_on_publish", "discount_code_id", "discount_amount_cents", "closing_date", "referral_source", "reference_number", "internal_notes", "year_built", "sqft", "foundation_type", "bedrooms", "bathrooms", "lot_size", "property_facts", "cover_photo_id", "cover_crop", "cover_image_key", "unit", "property_type", "commercial_subtype", "report_tier", "county", "is_automations_disabled", "template_snapshot", "template_snapshot_version", "report_theme_override", "require_defect_fields_override", "request_id", "concierge_status", "is_team_mode", "lead_inspector_id", "helper_inspector_ids", "data_version", "source_inspection_id", "root_inspection_id", "reinspection_round", "unit_inspection_mode", "location_options", "sampling_declaration", "pca_narrative", "deviations", "report_photo_mode", "scheduled_start_ms", "scheduled_end_ms", "duration_min") SELECT "id", "tenant_id", "inspector_id", "property_address", "address_place_id", "address_street", "address_city", "address_state", "address_zip", "address_county", "address_lat", "address_lng", "address_geocoded_at", "template_id", "date", "status", "report_status", "payment_status", "price_cents", "created_at", "confirmed_at", "cancel_reason", "cancel_notes", "is_payment_required", "is_agreement_required", "is_auto_sign_on_publish", "discount_code_id", "discount_amount_cents", "closing_date", "referral_source", "reference_number", "internal_notes", "year_built", "sqft", "foundation_type", "bedrooms", "bathrooms", "lot_size", "property_facts", "cover_photo_id", "cover_crop", "cover_image_key", "unit", "property_type", "commercial_subtype", "report_tier", "county", "is_automations_disabled", "template_snapshot", "template_snapshot_version", "report_theme_override", "require_defect_fields_override", "request_id", "concierge_status", "is_team_mode", "lead_inspector_id", "helper_inspector_ids", "data_version", "source_inspection_id", "root_inspection_id", "reinspection_round", "unit_inspection_mode", "location_options", "sampling_declaration", "pca_narrative", "deviations", "report_photo_mode", "scheduled_start_ms", "scheduled_end_ms", "duration_min" FROM `inspections`;--> statement-breakpoint -DROP TABLE `inspections`;--> statement-breakpoint -ALTER TABLE `__new_inspections` RENAME TO `inspections`;--> statement-breakpoint -PRAGMA foreign_keys=ON;--> statement-breakpoint -CREATE INDEX `idx_inspections_tenant` ON `inspections` (`tenant_id`);--> statement-breakpoint -CREATE INDEX `idx_inspections_request` ON `inspections` (`request_id`);--> statement-breakpoint -CREATE INDEX `idx_inspections_inspector` ON `inspections` (`inspector_id`);--> statement-breakpoint -CREATE INDEX `idx_inspections_tenant_status` ON `inspections` (`tenant_id`,`status`);--> statement-breakpoint -CREATE INDEX `idx_inspections_tenant_date` ON `inspections` (`tenant_id`,`date`);--> statement-breakpoint -CREATE INDEX `idx_inspections_inspector_date` ON `inspections` (`inspector_id`,`date`);--> statement-breakpoint -CREATE INDEX `idx_inspections_root` ON `inspections` (`root_inspection_id`); \ No newline at end of file diff --git a/migrations/0015_automations_recipient_discriminator.sql b/migrations/0015_automations_recipient_discriminator.sql deleted file mode 100644 index e04a0bd82..000000000 --- a/migrations/0015_automations_recipient_discriminator.sql +++ /dev/null @@ -1,39 +0,0 @@ -PRAGMA foreign_keys=OFF;--> statement-breakpoint -CREATE TABLE `__new_automations` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `name` text NOT NULL, - `trigger` text NOT NULL, - `recipient_kind` text NOT NULL, - `recipient_role_profile_id` text, - `delay_minutes` integer DEFAULT 0 NOT NULL, - `subject_template` text NOT NULL, - `body_template` text NOT NULL, - `email_template_id` text, - `conditions` text, - `channels` text DEFAULT '["email"]' NOT NULL, - `sms_body` text, - `sms_template_id` text, - `is_active` integer DEFAULT true NOT NULL, - `is_default` integer DEFAULT false NOT NULL, - `created_at` integer NOT NULL, - FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE no action -); ---> statement-breakpoint -INSERT INTO `__new_automations`("id", "tenant_id", "name", "trigger", "recipient_kind", "recipient_role_profile_id", "delay_minutes", "subject_template", "body_template", "email_template_id", "conditions", "channels", "sms_body", "sms_template_id", "is_active", "is_default", "created_at") -SELECT - "id", "tenant_id", "name", "trigger", - CASE recipient WHEN 'inspector' THEN 'inspector' WHEN 'all' THEN 'all' ELSE 'role' END, - CASE recipient - WHEN 'client' THEN (SELECT id FROM contact_role_profiles crp WHERE crp.tenant_id = automations.tenant_id AND crp.key = 'client' AND crp.is_active = 1 LIMIT 1) - WHEN 'buying_agent' THEN (SELECT id FROM contact_role_profiles crp WHERE crp.tenant_id = automations.tenant_id AND crp.key = 'buyer_agent' AND crp.is_active = 1 LIMIT 1) - WHEN 'selling_agent' THEN (SELECT id FROM contact_role_profiles crp WHERE crp.tenant_id = automations.tenant_id AND crp.key = 'listing_agent' AND crp.is_active = 1 LIMIT 1) - ELSE NULL - END, - "delay_minutes", "subject_template", "body_template", "email_template_id", "conditions", "channels", "sms_body", "sms_template_id", "is_active", "is_default", "created_at" -FROM `automations`; ---> statement-breakpoint -DROP TABLE `automations`;--> statement-breakpoint -ALTER TABLE `__new_automations` RENAME TO `automations`;--> statement-breakpoint -PRAGMA foreign_keys=ON;--> statement-breakpoint -CREATE INDEX `idx_automations_tenant` ON `automations` (`tenant_id`); diff --git a/migrations/0016_tiny_wrecker.sql b/migrations/0016_tiny_wrecker.sql deleted file mode 100644 index 9b628344d..000000000 --- a/migrations/0016_tiny_wrecker.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `automation_logs` ADD `recipient_role_key` text; \ No newline at end of file diff --git a/migrations/0017_ambiguous_stephen_strange.sql b/migrations/0017_ambiguous_stephen_strange.sql deleted file mode 100644 index 9699d42e0..000000000 --- a/migrations/0017_ambiguous_stephen_strange.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP INDEX `uq_automation_logs_event`;--> statement-breakpoint -CREATE UNIQUE INDEX `uq_automation_logs_event` ON `automation_logs` (`automation_id`,`inspection_id`,`event_id`,`channel`,`recipient`) WHERE event_id IS NOT NULL; \ No newline at end of file diff --git a/migrations/0018_report_style_profiles.sql b/migrations/0018_report_style_profiles.sql deleted file mode 100644 index 8ad9a5a5a..000000000 --- a/migrations/0018_report_style_profiles.sql +++ /dev/null @@ -1,20 +0,0 @@ --- Report Style Presets (Plan 1a) — repurpose the inert report_theme plumbing --- into the data-driven appearance-profile engine. --- --- tenant_configs.report_theme (text NOT NULL DEFAULT 'modern', enum modern|classic| --- minimal) becomes tenant_configs.default_profile_id (text NOT NULL DEFAULT --- 'signature', open-ended profile id). A plain RENAME COLUMN would keep the old --- 'modern' default (SQLite cannot ALTER a column default), which drifts from the --- schema's 'signature' default; tenant_configs is NOT an FK target, so ADD + DROP --- is D1-safe here and lands the correct default. The old enum values --- (modern|classic|minimal) are none of signature|meridian|terra, so every legacy --- row simply adopts the 'signature' default. -ALTER TABLE `tenant_configs` ADD `default_profile_id` text DEFAULT 'signature' NOT NULL;--> statement-breakpoint -ALTER TABLE `tenant_configs` DROP COLUMN `report_theme`;--> statement-breakpoint --- inspections is FK-referenced (no rebuild): RENAME is metadata-only, and the two --- new tweak columns are plain appends at the table end. -ALTER TABLE `inspections` RENAME COLUMN `report_theme_override` TO `profile_override`;--> statement-breakpoint -ALTER TABLE `inspections` ADD `badge_layout_override` text;--> statement-breakpoint -ALTER TABLE `inspections` ADD `report_photo_columns` integer;--> statement-breakpoint --- templates gains an optional default appearance profile per report type. -ALTER TABLE `templates` ADD `default_profile_id` text; \ No newline at end of file diff --git a/migrations/0019_black_payback.sql b/migrations/0019_black_payback.sql deleted file mode 100644 index 95794b98d..000000000 --- a/migrations/0019_black_payback.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE `inspector_credentials` ( - `id` text PRIMARY KEY NOT NULL, - `tenant_id` text NOT NULL, - `user_id` text NOT NULL, - `label` text NOT NULL, - `member_number` text, - `image_r2_key` text, - `sort_order` integer DEFAULT 0 NOT NULL, - `is_active` integer DEFAULT true NOT NULL, - `created_at` integer NOT NULL, - `updated_at` integer NOT NULL -); ---> statement-breakpoint -CREATE INDEX `idx_inspector_credentials_tenant` ON `inspector_credentials` (`tenant_id`);--> statement-breakpoint -CREATE INDEX `idx_inspector_credentials_user` ON `inspector_credentials` (`user_id`); \ No newline at end of file diff --git a/migrations/meta/0000_snapshot.json b/migrations/meta/0000_snapshot.json index 9c8a700b3..76205ef97 100644 --- a/migrations/meta/0000_snapshot.json +++ b/migrations/meta/0000_snapshot.json @@ -1,7 +1,7 @@ { "version": "6", "dialect": "sqlite", - "id": "e782a15b-2dbc-41a9-8db3-6456ff9a3a8b", + "id": "1f8c66c7-5d38-4128-8e5c-acb7b607b4ad", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "agreement_requests": { @@ -555,6 +555,13 @@ "notNull": true, "autoincrement": false }, + "recipient_role_key": { + "name": "recipient_role_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "channel": { "name": "channel", "type": "text", @@ -622,7 +629,9 @@ "columns": [ "automation_id", "inspection_id", - "event_id" + "event_id", + "channel", + "recipient" ], "isUnique": true, "where": "event_id IS NOT NULL" @@ -678,13 +687,20 @@ "notNull": true, "autoincrement": false }, - "recipient": { - "name": "recipient", + "recipient_kind": { + "name": "recipient_kind", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, + "recipient_role_profile_id": { + "name": "recipient_role_profile_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "delay_minutes": { "name": "delay_minutes", "type": "integer", @@ -743,8 +759,8 @@ "notNull": false, "autoincrement": false }, - "active": { - "name": "active", + "is_active": { + "name": "is_active", "type": "integer", "primaryKey": false, "notNull": true, @@ -957,6 +973,27 @@ "primaryKey": false, "notNull": true, "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "external_id": { + "name": "external_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "transparency": { + "name": "transparency", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { @@ -974,7 +1011,16 @@ "date" ], "isUnique": true, - "where": "is_available = 0" + "where": "is_available = 0 AND source IS NULL" + }, + "uq_avail_overrides_external": { + "name": "uq_avail_overrides_external", + "columns": [ + "inspector_id", + "source", + "external_id" + ], + "isUnique": true } }, "foreignKeys": { @@ -1009,6 +1055,298 @@ "uniqueConstraints": {}, "checkConstraints": {} }, + "calendar_blocks": { + "name": "calendar_blocks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_time": { + "name": "start_time", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "end_time": { + "name": "end_time", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_all_day": { + "name": "is_all_day", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_calendar_blocks_tenant_user_date": { + "name": "idx_calendar_blocks_tenant_user_date", + "columns": [ + "tenant_id", + "user_id", + "date" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "calendar_connection_read_calendars": { + "name": "calendar_connection_read_calendars", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "connection_id": { + "name": "connection_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "external_calendar_id": { + "name": "external_calendar_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "access_role": { + "name": "access_role", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "uq_conn_read_cal": { + "name": "uq_conn_read_cal", + "columns": [ + "connection_id", + "external_calendar_id" + ], + "isUnique": true + }, + "idx_conn_read_cal_tenant": { + "name": "idx_conn_read_cal_tenant", + "columns": [ + "tenant_id", + "connection_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "calendar_connections": { + "name": "calendar_connections", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "auth_type": { + "name": "auth_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credentials_enc": { + "name": "credentials_enc", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credentials_dek_enc": { + "name": "credentials_dek_enc", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "capabilities": { + "name": "capabilities", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "calendar_id": { + "name": "calendar_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "connected_at": { + "name": "connected_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_sync_at": { + "name": "last_sync_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "uq_calendar_connections_user_provider": { + "name": "uq_calendar_connections_user_provider", + "columns": [ + "user_id", + "provider" + ], + "isUnique": true + }, + "idx_calendar_connections_tenant_user": { + "name": "idx_calendar_connections_tenant_user", + "columns": [ + "tenant_id", + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, "comment_usage": { "name": "comment_usage", "columns": { @@ -1299,8 +1637,8 @@ "notNull": false, "autoincrement": false }, - "disabled": { - "name": "disabled", + "is_disabled": { + "name": "is_disabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -1380,24 +1718,150 @@ "type": "integer", "primaryKey": false, "notNull": true, - "autoincrement": false + "autoincrement": false + }, + "confirmed_at": { + "name": "confirmed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_concierge_tokens_expiry": { + "name": "idx_concierge_tokens_expiry", + "columns": [ + "expires_at" + ], + "isUnique": false + }, + "idx_concierge_confirm_token_hash": { + "name": "idx_concierge_confirm_token_hash", + "columns": [ + "token_hash" + ], + "isUnique": true + } + }, + "foreignKeys": { + "concierge_confirm_tokens_inspection_id_inspections_id_fk": { + "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", + "tableFrom": "concierge_confirm_tokens", + "tableTo": "inspections", + "columnsFrom": [ + "inspection_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "contact_role_profiles": { + "name": "contact_role_profiles", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email_template_id": { + "name": "email_template_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sms_template_id": { + "name": "sms_template_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_system": { + "name": "is_system", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true }, - "confirmed_at": { - "name": "confirmed_at", + "created_at": { + "name": "created_at", "type": "integer", "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, + "notNull": true, "autoincrement": false }, - "created_at": { - "name": "created_at", + "updated_at": { + "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, @@ -1405,36 +1869,24 @@ } }, "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", + "idx_crp_tenant": { + "name": "idx_crp_tenant", "columns": [ - "expires_at" + "tenant_id" ], "isUnique": false }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", + "uq_crp_tenant_key": { + "name": "uq_crp_tenant_key", "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" + "tenant_id", + "key" ], - "onDelete": "no action", - "onUpdate": "no action" + "isUnique": true, + "where": "is_active = 1" } }, + "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} @@ -1856,8 +2308,8 @@ "autoincrement": false, "default": "'#6b7280'" }, - "drives_summary": { - "name": "drives_summary", + "is_summary_driver": { + "name": "is_summary_driver", "type": "integer", "primaryKey": false, "notNull": true, @@ -1962,8 +2414,8 @@ "notNull": false, "autoincrement": false }, - "active": { - "name": "active", + "is_active": { + "name": "is_active", "type": "integer", "primaryKey": false, "notNull": true, @@ -2052,32 +2504,32 @@ "notNull": true, "autoincrement": false }, - "requested": { - "name": "requested", + "is_requested": { + "name": "is_requested", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "received": { - "name": "received", + "is_received": { + "name": "is_received", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "reviewed": { - "name": "reviewed", + "is_reviewed": { + "name": "is_reviewed", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "na": { - "name": "na", + "is_na": { + "name": "is_na", "type": "integer", "primaryKey": false, "notNull": true, @@ -2460,8 +2912,8 @@ "autoincrement": false, "default": 0 }, - "active": { - "name": "active", + "is_active": { + "name": "is_active", "type": "integer", "primaryKey": false, "notNull": true, @@ -3222,6 +3674,82 @@ "uniqueConstraints": {}, "checkConstraints": {} }, + "inspection_people": { + "name": "inspection_people", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "inspection_id": { + "name": "inspection_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "contact_id": { + "name": "contact_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role_profile_id": { + "name": "role_profile_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_ip_inspection": { + "name": "idx_ip_inspection", + "columns": [ + "inspection_id" + ], + "isUnique": false + }, + "idx_ip_tenant": { + "name": "idx_ip_tenant", + "columns": [ + "tenant_id" + ], + "isUnique": false + }, + "uq_ip_insp_contact_role": { + "name": "uq_ip_insp_contact_role", + "columns": [ + "inspection_id", + "contact_id", + "role_profile_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, "inspection_requests": { "name": "inspection_requests", "columns": { @@ -3646,8 +4174,8 @@ "notNull": false, "autoincrement": false }, - "enabled": { - "name": "enabled", + "is_enabled": { + "name": "is_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -3878,34 +4406,6 @@ "notNull": false, "autoincrement": false }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, "template_id": { "name": "template_id", "type": "text", @@ -3944,13 +4444,6 @@ "autoincrement": false, "default": "'unpaid'" }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, "price_cents": { "name": "price_cents", "type": "integer", @@ -3987,24 +4480,24 @@ "notNull": false, "autoincrement": false }, - "payment_required": { - "name": "payment_required", + "is_payment_required": { + "name": "is_payment_required", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "agreement_required": { - "name": "agreement_required", + "is_agreement_required": { + "name": "is_agreement_required", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "auto_sign_on_publish": { - "name": "auto_sign_on_publish", + "is_auto_sign_on_publish": { + "name": "is_auto_sign_on_publish", "type": "integer", "primaryKey": false, "notNull": true, @@ -4158,15 +4651,8 @@ "notNull": false, "autoincrement": false }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "disable_automations": { - "name": "disable_automations", + "is_automations_disabled": { + "name": "is_automations_disabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -4188,8 +4674,8 @@ "autoincrement": false, "default": 1 }, - "report_theme_override": { - "name": "report_theme_override", + "profile_override": { + "name": "profile_override", "type": "text", "primaryKey": false, "notNull": false, @@ -4216,8 +4702,8 @@ "notNull": false, "autoincrement": false }, - "team_mode": { - "name": "team_mode", + "is_team_mode": { + "name": "is_team_mode", "type": "integer", "primaryKey": false, "notNull": true, @@ -4310,6 +4796,41 @@ "primaryKey": false, "notNull": false, "autoincrement": false + }, + "scheduled_start_ms": { + "name": "scheduled_start_ms", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scheduled_end_ms": { + "name": "scheduled_end_ms", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "duration_min": { + "name": "duration_min", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "badge_layout_override": { + "name": "badge_layout_override", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "report_photo_columns": { + "name": "report_photo_columns", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { @@ -4334,13 +4855,6 @@ ], "isUnique": false }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, "idx_inspections_tenant_status": { "name": "idx_inspections_tenant_status", "columns": [ @@ -4357,14 +4871,6 @@ ], "isUnique": false }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, "idx_inspections_inspector_date": { "name": "idx_inspections_inspector_date", "columns": [ @@ -4421,46 +4927,130 @@ "onDelete": "no action", "onUpdate": "no action" }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" + "inspections_discount_code_id_discount_codes_id_fk": { + "name": "inspections_discount_code_id_discount_codes_id_fk", + "tableFrom": "inspections", + "tableTo": "discount_codes", + "columnsFrom": [ + "discount_code_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "inspections_request_id_inspection_requests_id_fk": { + "name": "inspections_request_id_inspection_requests_id_fk", + "tableFrom": "inspections", + "tableTo": "inspection_requests", + "columnsFrom": [ + "request_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "inspector_credentials": { + "name": "inspector_credentials", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "member_number": { + "name": "member_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "image_r2_key": { + "name": "image_r2_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "is_active": { + "name": "is_active", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_inspector_credentials_tenant": { + "name": "idx_inspector_credentials_tenant", + "columns": [ + "tenant_id" ], - "columnsTo": [ - "id" + "isUnique": false + }, + "idx_inspector_credentials_user": { + "name": "idx_inspector_credentials_user", + "columns": [ + "user_id" ], - "onDelete": "no action", - "onUpdate": "no action" + "isUnique": false } }, + "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} @@ -4588,6 +5178,14 @@ "primaryKey": false, "notNull": true, "autoincrement": false + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'USD'" } }, "indexes": { @@ -4720,8 +5318,8 @@ "autoincrement": false, "default": 0 }, - "featured": { - "name": "featured", + "is_featured": { + "name": "is_featured", "type": "integer", "primaryKey": false, "notNull": true, @@ -4748,7 +5346,7 @@ "name": "idx_marketplace_libraries_kind_featured", "columns": [ "kind", - "featured" + "is_featured" ], "isUnique": false } @@ -4819,8 +5417,8 @@ "autoincrement": false, "default": 0 }, - "featured": { - "name": "featured", + "is_featured": { + "name": "is_featured", "type": "integer", "primaryKey": false, "notNull": true, @@ -5054,8 +5652,8 @@ "notNull": false, "autoincrement": false }, - "sender_attached": { - "name": "sender_attached", + "has_sender_attached": { + "name": "has_sender_attached", "type": "integer", "primaryKey": false, "notNull": true, @@ -5442,8 +6040,8 @@ "notNull": false, "autoincrement": false }, - "sync_enabled": { - "name": "sync_enabled", + "is_sync_enabled": { + "name": "is_sync_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -5610,8 +6208,8 @@ "autoincrement": false, "default": 0 }, - "resolved": { - "name": "resolved", + "is_resolved": { + "name": "is_resolved", "type": "integer", "primaryKey": false, "notNull": true, @@ -6233,8 +6831,8 @@ "notNull": true, "autoincrement": false }, - "dual_role": { - "name": "dual_role", + "is_dual_role": { + "name": "is_dual_role", "type": "integer", "primaryKey": false, "notNull": true, @@ -6519,8 +7117,8 @@ "notNull": false, "autoincrement": false }, - "active": { - "name": "active", + "is_active": { + "name": "is_active", "type": "integer", "primaryKey": false, "notNull": true, @@ -7003,13 +7601,20 @@ "notNull": false, "autoincrement": false }, - "featured": { - "name": "featured", + "is_featured": { + "name": "is_featured", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false + }, + "default_profile_id": { + "name": "default_profile_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { @@ -7047,6 +7652,75 @@ "uniqueConstraints": {}, "checkConstraints": {} }, + "tenant_custom_holidays": { + "name": "tenant_custom_holidays", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "date": { + "name": "date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "uq_tenant_custom_holidays_tenant_date": { + "name": "uq_tenant_custom_holidays_tenant_date", + "columns": [ + "tenant_id", + "date" + ], + "isUnique": true + }, + "idx_tenant_custom_holidays_tenant_date": { + "name": "idx_tenant_custom_holidays_tenant_date", + "columns": [ + "tenant_id", + "date" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, "tenant_library_imports": { "name": "tenant_library_imports", "columns": { @@ -7384,82 +8058,6 @@ "uniqueConstraints": {}, "checkConstraints": {} }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, "email_templates": { "name": "email_templates", "columns": { @@ -7491,8 +8089,8 @@ "notNull": false, "autoincrement": false }, - "enabled": { - "name": "enabled", + "is_enabled": { + "name": "is_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -7580,24 +8178,24 @@ "notNull": false, "autoincrement": false }, - "pdf_show_footer": { - "name": "pdf_show_footer", + "is_pdf_footer_shown": { + "name": "is_pdf_footer_shown", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": true }, - "pdf_show_page_numbers": { - "name": "pdf_show_page_numbers", + "is_pdf_page_numbers_shown": { + "name": "is_pdf_page_numbers_shown", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": true }, - "pdf_show_license": { - "name": "pdf_show_license", + "is_pdf_license_shown": { + "name": "is_pdf_license_shown", "type": "integer", "primaryKey": false, "notNull": true, @@ -7713,13 +8311,13 @@ "notNull": false, "autoincrement": false }, - "report_theme": { - "name": "report_theme", + "default_profile_id": { + "name": "default_profile_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, - "default": "'modern'" + "default": "'signature'" }, "attention_thresholds": { "name": "attention_thresholds", @@ -7736,40 +8334,40 @@ "notNull": false, "autoincrement": false }, - "show_estimates": { - "name": "show_estimates", + "is_estimates_shown": { + "name": "is_estimates_shown", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "enable_repair_list": { - "name": "enable_repair_list", + "is_repair_list_enabled": { + "name": "is_repair_list_enabled", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "enable_customer_repair_export": { - "name": "enable_customer_repair_export", + "is_customer_repair_export_enabled": { + "name": "is_customer_repair_export_enabled", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "block_unpaid": { - "name": "block_unpaid", + "is_unpaid_blocked": { + "name": "is_unpaid_blocked", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "block_unsigned_agreement": { - "name": "block_unsigned_agreement", + "is_unsigned_agreement_blocked": { + "name": "is_unsigned_agreement_blocked", "type": "integer", "primaryKey": false, "notNull": true, @@ -7790,48 +8388,48 @@ "notNull": false, "autoincrement": false }, - "concierge_review_required": { - "name": "concierge_review_required", + "is_concierge_review_required": { + "name": "is_concierge_review_required", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "allow_inspector_choice": { - "name": "allow_inspector_choice", + "is_inspector_choice_allowed": { + "name": "is_inspector_choice_allowed", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "enable_pdf_pipeline": { - "name": "enable_pdf_pipeline", + "is_pdf_pipeline_enabled": { + "name": "is_pdf_pipeline_enabled", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "team_mode_default": { - "name": "team_mode_default", + "is_team_mode_default": { + "name": "is_team_mode_default", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "apprentice_review_required": { - "name": "apprentice_review_required", + "is_apprentice_review_required": { + "name": "is_apprentice_review_required", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, - "guest_invites_enabled": { - "name": "guest_invites_enabled", + "is_guest_invites_enabled": { + "name": "is_guest_invites_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -7861,8 +8459,8 @@ "notNull": false, "autoincrement": false }, - "collab_editing": { - "name": "collab_editing", + "is_collab_editing_enabled": { + "name": "is_collab_editing_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -7891,8 +8489,8 @@ "autoincrement": false, "default": "'resend'" }, - "managed_eligible": { - "name": "managed_eligible", + "is_managed_eligible": { + "name": "is_managed_eligible", "type": "integer", "primaryKey": false, "notNull": true, @@ -7907,8 +8505,8 @@ "autoincrement": false, "default": "'twilio'" }, - "reserve_schedule_enabled": { - "name": "reserve_schedule_enabled", + "is_reserve_schedule_enabled": { + "name": "is_reserve_schedule_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -7929,6 +8527,69 @@ "primaryKey": false, "notNull": false, "autoincrement": false + }, + "default_timezone": { + "name": "default_timezone", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'UTC'" + }, + "booking_slot_mode": { + "name": "booking_slot_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'fixed'" + }, + "booking_slot_interval_min": { + "name": "booking_slot_interval_min", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 30 + }, + "holiday_region": { + "name": "holiday_region", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "holiday_public_policy": { + "name": "holiday_public_policy", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'open'" + }, + "holiday_internal_policy": { + "name": "holiday_internal_policy", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'advisory'" + }, + "default_locale": { + "name": "default_locale", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'en-US'" + }, + "currency": { + "name": "currency", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'USD'" } }, "indexes": {}, @@ -8340,8 +9001,8 @@ "notNull": false, "autoincrement": false }, - "signature_enabled": { - "name": "signature_enabled", + "is_signature_enabled": { + "name": "is_signature_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -8363,20 +9024,6 @@ "autoincrement": false, "default": "'manager'" }, - "google_refresh_token": { - "name": "google_refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "google_calendar_id": { - "name": "google_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, "onboarding_state": { "name": "onboarding_state", "type": "text", @@ -8398,8 +9045,8 @@ "notNull": false, "autoincrement": false }, - "totp_enabled": { - "name": "totp_enabled", + "is_totp_enabled": { + "name": "is_totp_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -8420,24 +9067,24 @@ "notNull": false, "autoincrement": false }, - "notify_on_referral": { - "name": "notify_on_referral", + "is_referral_notification_enabled": { + "name": "is_referral_notification_enabled", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": true }, - "notify_on_report": { - "name": "notify_on_report", + "is_report_notification_enabled": { + "name": "is_report_notification_enabled", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": true }, - "notify_on_paid": { - "name": "notify_on_paid", + "is_paid_notification_enabled": { + "name": "is_paid_notification_enabled", "type": "integer", "primaryKey": false, "notNull": true, @@ -8493,6 +9140,20 @@ "primaryKey": false, "notNull": false, "autoincrement": false + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "locale": { + "name": "locale", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { @@ -8815,8 +9476,8 @@ "notNull": false, "autoincrement": false }, - "ok": { - "name": "ok", + "is_ok": { + "name": "is_ok", "type": "integer", "primaryKey": false, "notNull": true, diff --git a/migrations/meta/0001_snapshot.json b/migrations/meta/0001_snapshot.json deleted file mode 100644 index cb4e8bae7..000000000 --- a/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,9402 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "172ae479-54d3-4f2a-bfd7-d5ec51e2529f", - "prevId": "e782a15b-2dbc-41a9-8db3-6456ff9a3a8b", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "google_refresh_token": { - "name": "google_refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "google_calendar_id": { - "name": "google_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} diff --git a/migrations/meta/0002_snapshot.json b/migrations/meta/0002_snapshot.json deleted file mode 100644 index 0adec1afc..000000000 --- a/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,9417 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "ab631805-b4e5-4397-b606-2b1c3902c6ec", - "prevId": "172ae479-54d3-4f2a-bfd7-d5ec51e2529f", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "google_refresh_token": { - "name": "google_refresh_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "google_calendar_id": { - "name": "google_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0003_snapshot.json b/migrations/meta/0003_snapshot.json deleted file mode 100644 index 9a20198ab..000000000 --- a/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,9507 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "5acb2b7b-eab9-4bf6-94df-21773136b4b2", - "prevId": "ab631805-b4e5-4397-b606-2b1c3902c6ec", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0004_snapshot.json b/migrations/meta/0004_snapshot.json deleted file mode 100644 index 0f1dd2cd7..000000000 --- a/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,9605 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "c049897c-6dea-4064-a4eb-f5bdbebb57de", - "prevId": "5acb2b7b-eab9-4bf6-94df-21773136b4b2", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0005_snapshot.json b/migrations/meta/0005_snapshot.json deleted file mode 100644 index 7f26f38bb..000000000 --- a/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,9621 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "df18339b-9e2d-424e-aceb-c91c209047ba", - "prevId": "c049897c-6dea-4064-a4eb-f5bdbebb57de", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0006_snapshot.json b/migrations/meta/0006_snapshot.json deleted file mode 100644 index 25d964eb8..000000000 --- a/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,9713 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "13d64f53-a2ef-44d3-bc5b-7c278e0200ae", - "prevId": "df18339b-9e2d-424e-aceb-c91c209047ba", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0007_snapshot.json b/migrations/meta/0007_snapshot.json deleted file mode 100644 index e200816ab..000000000 --- a/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,9736 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "4a964de4-ec58-4523-86ca-a003fdc52b41", - "prevId": "13d64f53-a2ef-44d3-bc5b-7c278e0200ae", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0008_snapshot.json b/migrations/meta/0008_snapshot.json deleted file mode 100644 index 633f1e570..000000000 --- a/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,9744 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "dc76e1bf-ed40-42af-9879-ea0b70787c15", - "prevId": "4a964de4-ec58-4523-86ca-a003fdc52b41", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0009_snapshot.json b/migrations/meta/0009_snapshot.json deleted file mode 100644 index 2018cc248..000000000 --- a/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,9751 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "e8bb45be-65e0-43a4-8e45-6b14028744ad", - "prevId": "dc76e1bf-ed40-42af-9879-ea0b70787c15", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0010_snapshot.json b/migrations/meta/0010_snapshot.json deleted file mode 100644 index d94626b32..000000000 --- a/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,9772 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "5ff94ff2-93d7-438e-abe2-1953a4daaf54", - "prevId": "e8bb45be-65e0-43a4-8e45-6b14028744ad", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0" - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0011_snapshot.json b/migrations/meta/0011_snapshot.json deleted file mode 100644 index dfbed21f0..000000000 --- a/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,9802 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "e2e5269b-67e6-4bdb-a020-879c378f0ab6", - "prevId": "5ff94ff2-93d7-438e-abe2-1953a4daaf54", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0012_snapshot.json b/migrations/meta/0012_snapshot.json deleted file mode 100644 index bc3d2b704..000000000 --- a/migrations/meta/0012_snapshot.json +++ /dev/null @@ -1,9885 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "33498a0c-65a7-44f0-be35-cb470d589d22", - "prevId": "e2e5269b-67e6-4bdb-a020-879c378f0ab6", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0013_snapshot.json b/migrations/meta/0013_snapshot.json deleted file mode 100644 index ffb393adb..000000000 --- a/migrations/meta/0013_snapshot.json +++ /dev/null @@ -1,10075 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "e6338a12-4431-4d59-ae8f-ef030ed571c4", - "prevId": "33498a0c-65a7-44f0-be35-cb470d589d22", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_contact_id": { - "name": "client_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "referred_by_agent_id": { - "name": "referred_by_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "selling_agent_id": { - "name": "selling_agent_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_agent": { - "name": "idx_inspections_agent", - "columns": [ - "referred_by_agent_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_tenant_client_email": { - "name": "idx_inspections_tenant_client_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_selling_agent_id_contacts_id_fk": { - "name": "inspections_selling_agent_id_contacts_id_fk", - "tableFrom": "inspections", - "tableTo": "contacts", - "columnsFrom": [ - "selling_agent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0014_snapshot.json b/migrations/meta/0014_snapshot.json deleted file mode 100644 index 96204b1de..000000000 --- a/migrations/meta/0014_snapshot.json +++ /dev/null @@ -1,10005 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "6b75672a-8e40-42b2-a33c-133d1cdde46c", - "prevId": "e6338a12-4431-4d59-ae8f-ef030ed571c4", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0015_snapshot.json b/migrations/meta/0015_snapshot.json deleted file mode 100644 index 2635f6778..000000000 --- a/migrations/meta/0015_snapshot.json +++ /dev/null @@ -1,10012 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "1c25d765-df21-490f-b45e-1c20c2c5bab5", - "prevId": "6b75672a-8e40-42b2-a33c-133d1cdde46c", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_kind": { - "name": "recipient_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_profile_id": { - "name": "recipient_role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} diff --git a/migrations/meta/0016_snapshot.json b/migrations/meta/0016_snapshot.json deleted file mode 100644 index c70ed2505..000000000 --- a/migrations/meta/0016_snapshot.json +++ /dev/null @@ -1,10019 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "409168d4-06a6-4aab-9a70-8cb89f7abdc4", - "prevId": "1c25d765-df21-490f-b45e-1c20c2c5bab5", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_key": { - "name": "recipient_role_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_kind": { - "name": "recipient_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_profile_id": { - "name": "recipient_role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0017_snapshot.json b/migrations/meta/0017_snapshot.json deleted file mode 100644 index cdade49d3..000000000 --- a/migrations/meta/0017_snapshot.json +++ /dev/null @@ -1,10021 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "44f640ad-a97b-484e-8513-32f32e1deb22", - "prevId": "409168d4-06a6-4aab-9a70-8cb89f7abdc4", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_key": { - "name": "recipient_role_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id", - "channel", - "recipient" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_kind": { - "name": "recipient_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_profile_id": { - "name": "recipient_role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "report_theme_override": { - "name": "report_theme_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_theme": { - "name": "report_theme", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'modern'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0018_snapshot.json b/migrations/meta/0018_snapshot.json deleted file mode 100644 index c757b81ef..000000000 --- a/migrations/meta/0018_snapshot.json +++ /dev/null @@ -1,10042 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "ecebec31-bf8a-40c9-abbf-8622bce21939", - "prevId": "44f640ad-a97b-484e-8513-32f32e1deb22", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_key": { - "name": "recipient_role_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id", - "channel", - "recipient" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_kind": { - "name": "recipient_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_profile_id": { - "name": "recipient_role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "profile_override": { - "name": "profile_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "badge_layout_override": { - "name": "badge_layout_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_columns": { - "name": "report_photo_columns", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "default_profile_id": { - "name": "default_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_profile_id": { - "name": "default_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'signature'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/0019_snapshot.json b/migrations/meta/0019_snapshot.json deleted file mode 100644 index 9b87f9678..000000000 --- a/migrations/meta/0019_snapshot.json +++ /dev/null @@ -1,10139 +0,0 @@ -{ - "version": "6", - "dialect": "sqlite", - "id": "444bae1b-1c4f-4c1b-abd7-3fc207f68f9b", - "prevId": "ecebec31-bf8a-40c9-abbf-8622bce21939", - "tables": { - "agreement_requests": { - "name": "agreement_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signature_base64": { - "name": "inspector_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_signed_at": { - "name": "inspector_signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_user_id": { - "name": "inspector_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_snapshot": { - "name": "content_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completion_policy": { - "name": "completion_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'all'" - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "purged_at": { - "name": "purged_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "agreement_requests_token_unique": { - "name": "agreement_requests_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_agreement_requests_verify_token": { - "name": "idx_agreement_requests_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - }, - "idx_agreement_requests_tenant": { - "name": "idx_agreement_requests_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agreement_requests_inspection": { - "name": "idx_agreement_requests_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_agreement_requests_token_hash": { - "name": "idx_agreement_requests_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "agreement_requests_tenant_id_tenants_id_fk": { - "name": "agreement_requests_tenant_id_tenants_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspection_id_inspections_id_fk": { - "name": "agreement_requests_inspection_id_inspections_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_agreement_id_agreements_id_fk": { - "name": "agreement_requests_agreement_id_agreements_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agreement_requests_inspector_user_id_users_id_fk": { - "name": "agreement_requests_inspector_user_id_users_id_fk", - "tableFrom": "agreement_requests", - "tableTo": "users", - "columnsFrom": [ - "inspector_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreement_signers": { - "name": "agreement_signers", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "signature_base64": { - "name": "signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "viewed_at": { - "name": "viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_of": { - "name": "on_behalf_of", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "on_behalf_disclaimer": { - "name": "on_behalf_disclaimer", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_reminded_at": { - "name": "last_reminded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreement_signers_tenant_request": { - "name": "idx_agreement_signers_tenant_request", - "columns": [ - "tenant_id", - "request_id" - ], - "isUnique": false - }, - "idx_agreement_signers_request_email": { - "name": "idx_agreement_signers_request_email", - "columns": [ - "request_id", - "email" - ], - "isUnique": true - }, - "idx_agreement_signers_token_hash": { - "name": "idx_agreement_signers_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agreements": { - "name": "agreements", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content": { - "name": "content", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agreements_tenant": { - "name": "idx_agreements_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agreements_tenant_id_tenants_id_fk": { - "name": "agreements_tenant_id_tenants_id_fk", - "tableFrom": "agreements", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automation_logs": { - "name": "automation_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "automation_id": { - "name": "automation_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient": { - "name": "recipient", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_key": { - "name": "recipient_role_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'email'" - }, - "send_at": { - "name": "send_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "delivered_at": { - "name": "delivered_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_automation_logs_pending": { - "name": "idx_automation_logs_pending", - "columns": [ - "tenant_id", - "status", - "send_at" - ], - "isUnique": false - }, - "idx_automation_logs_insp": { - "name": "idx_automation_logs_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_automation_logs_event": { - "name": "uq_automation_logs_event", - "columns": [ - "automation_id", - "inspection_id", - "event_id", - "channel", - "recipient" - ], - "isUnique": true, - "where": "event_id IS NOT NULL" - } - }, - "foreignKeys": { - "automation_logs_tenant_id_tenants_id_fk": { - "name": "automation_logs_tenant_id_tenants_id_fk", - "tableFrom": "automation_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "automations": { - "name": "automations", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_kind": { - "name": "recipient_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_role_profile_id": { - "name": "recipient_role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "delay_minutes": { - "name": "delay_minutes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "subject_template": { - "name": "subject_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body_template": { - "name": "body_template", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "conditions": { - "name": "conditions", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "channels": { - "name": "channels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[\"email\"]'" - }, - "sms_body": { - "name": "sms_body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_automations_tenant": { - "name": "idx_automations_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "automations_tenant_id_tenants_id_fk": { - "name": "automations_tenant_id_tenants_id_fk", - "tableFrom": "automations", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability": { - "name": "availability", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "day_of_week": { - "name": "day_of_week", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_availability_inspector": { - "name": "idx_availability_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_availability_window_unique": { - "name": "idx_availability_window_unique", - "columns": [ - "inspector_id", - "day_of_week", - "start_time" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_tenant_id_tenants_id_fk": { - "name": "availability_tenant_id_tenants_id_fk", - "tableFrom": "availability", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_inspector_id_users_id_fk": { - "name": "availability_inspector_id_users_id_fk", - "tableFrom": "availability", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "availability_overrides": { - "name": "availability_overrides", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_available": { - "name": "is_available", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source": { - "name": "source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "external_id": { - "name": "external_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "transparency": { - "name": "transparency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_avail_overrides_insp": { - "name": "idx_avail_overrides_insp", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_avail_overrides_block_unique": { - "name": "idx_avail_overrides_block_unique", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": true, - "where": "is_available = 0 AND source IS NULL" - }, - "uq_avail_overrides_external": { - "name": "uq_avail_overrides_external", - "columns": [ - "inspector_id", - "source", - "external_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "availability_overrides_tenant_id_tenants_id_fk": { - "name": "availability_overrides_tenant_id_tenants_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "availability_overrides_inspector_id_users_id_fk": { - "name": "availability_overrides_inspector_id_users_id_fk", - "tableFrom": "availability_overrides", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_blocks": { - "name": "calendar_blocks", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "start_time": { - "name": "start_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "end_time": { - "name": "end_time", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_all_day": { - "name": "is_all_day", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_calendar_blocks_tenant_user_date": { - "name": "idx_calendar_blocks_tenant_user_date", - "columns": [ - "tenant_id", - "user_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connection_read_calendars": { - "name": "calendar_connection_read_calendars", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connection_id": { - "name": "connection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "external_calendar_id": { - "name": "external_calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_role": { - "name": "access_role", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_conn_read_cal": { - "name": "uq_conn_read_cal", - "columns": [ - "connection_id", - "external_calendar_id" - ], - "isUnique": true - }, - "idx_conn_read_cal_tenant": { - "name": "idx_conn_read_cal_tenant", - "columns": [ - "tenant_id", - "connection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "calendar_connections": { - "name": "calendar_connections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "auth_type": { - "name": "auth_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_enc": { - "name": "credentials_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "credentials_dek_enc": { - "name": "credentials_dek_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "capabilities": { - "name": "capabilities", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "calendar_id": { - "name": "calendar_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "connected_at": { - "name": "connected_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_calendar_connections_user_provider": { - "name": "uq_calendar_connections_user_provider", - "columns": [ - "user_id", - "provider" - ], - "isUnique": true - }, - "idx_calendar_connections_tenant_user": { - "name": "idx_calendar_connections_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comment_usage": { - "name": "comment_usage", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_id": { - "name": "comment_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "use_count": { - "name": "use_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "last_used_at": { - "name": "last_used_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_comment_usage_user_last_used": { - "name": "idx_comment_usage_user_last_used", - "columns": [ - "tenant_id", - "user_id", - "last_used_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comment_usage_comment_id_comments_id_fk": { - "name": "comment_usage_comment_id_comments_id_fk", - "tableFrom": "comment_usage", - "tableTo": "comments", - "columnsFrom": [ - "comment_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "comment_usage_tenant_id_user_id_comment_id_pk": { - "columns": [ - "tenant_id", - "user_id", - "comment_id" - ], - "name": "comment_usage_tenant_id_user_id_comment_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "comments": { - "name": "comments", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_bucket": { - "name": "rating_bucket", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section": { - "name": "section", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "section_ids": { - "name": "section_ids", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_labels": { - "name": "item_labels", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "trigger_code": { - "name": "trigger_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "search_keywords": { - "name": "search_keywords", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "severity": { - "name": "severity", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "repair_summary": { - "name": "repair_summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_min_cents": { - "name": "estimate_min_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "estimate_max_cents": { - "name": "estimate_max_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "recommended_contractor_type_id": { - "name": "recommended_contractor_type_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_comments_tenant": { - "name": "idx_comments_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_comments_rating_bucket": { - "name": "idx_comments_rating_bucket", - "columns": [ - "tenant_id", - "rating_bucket" - ], - "isUnique": false - }, - "idx_comments_library_id": { - "name": "idx_comments_library_id", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "comments_tenant_id_tenants_id_fk": { - "name": "comments_tenant_id_tenants_id_fk", - "tableFrom": "comments", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "commercial_subtypes": { - "name": "commercial_subtypes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_disabled": { - "name": "is_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_commercial_subtypes_tenant_name": { - "name": "idx_commercial_subtypes_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": { - "commercial_subtypes_tenant_id_tenants_id_fk": { - "name": "commercial_subtypes_tenant_id_tenants_id_fk", - "tableFrom": "commercial_subtypes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "concierge_confirm_tokens": { - "name": "concierge_confirm_tokens", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_concierge_tokens_expiry": { - "name": "idx_concierge_tokens_expiry", - "columns": [ - "expires_at" - ], - "isUnique": false - }, - "idx_concierge_confirm_token_hash": { - "name": "idx_concierge_confirm_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "concierge_confirm_tokens_inspection_id_inspections_id_fk": { - "name": "concierge_confirm_tokens_inspection_id_inspections_id_fk", - "tableFrom": "concierge_confirm_tokens", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contact_role_profiles": { - "name": "contact_role_profiles", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key": { - "name": "key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email_template_id": { - "name": "email_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sms_template_id": { - "name": "sms_template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_system": { - "name": "is_system", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_crp_tenant": { - "name": "idx_crp_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_crp_tenant_key": { - "name": "uq_crp_tenant_key", - "columns": [ - "tenant_id", - "key" - ], - "isUnique": true, - "where": "is_active = 1" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contacts": { - "name": "contacts", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agency": { - "name": "agency", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_by_user_id": { - "name": "created_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_contacts_type": { - "name": "idx_contacts_type", - "columns": [ - "tenant_id", - "type" - ], - "isUnique": false - }, - "idx_contacts_tenant": { - "name": "idx_contacts_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_contacts_tenant_email": { - "name": "uq_contacts_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "email IS NOT NULL AND archived_at IS NULL" - } - }, - "foreignKeys": { - "contacts_tenant_id_tenants_id_fk": { - "name": "contacts_tenant_id_tenants_id_fk", - "tableFrom": "contacts", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "contractor_types": { - "name": "contractor_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_contractor_types_tenant": { - "name": "idx_contractor_types_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "cost_items": { - "name": "cost_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "building_id": { - "name": "building_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "instance_index": { - "name": "instance_index", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_id": { - "name": "unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "system": { - "name": "system", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "component": { - "name": "component", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "location": { - "name": "location", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "cost_method": { - "name": "cost_method", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uom": { - "name": "uom", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_cost_cents": { - "name": "unit_cost_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lump_sum_cents": { - "name": "lump_sum_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eul": { - "name": "eul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "eff_age": { - "name": "eff_age", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rul": { - "name": "rul", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "suggested_remedy": { - "name": "suggested_remedy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "''" - }, - "bucket": { - "name": "bucket", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_ref": { - "name": "section_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_ref": { - "name": "photo_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_cost_items_tenant_inspection": { - "name": "idx_cost_items_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_cost_items_finding_key": { - "name": "idx_cost_items_finding_key", - "columns": [ - "finding_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "defect_categories": { - "name": "defect_categories", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6b7280'" - }, - "is_summary_driver": { - "name": "is_summary_driver", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_defect_categories_tenant": { - "name": "idx_defect_categories_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "discount_codes": { - "name": "discount_codes", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "code": { - "name": "code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "max_uses": { - "name": "max_uses", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "uses_count": { - "name": "uses_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_discount_codes_tenant": { - "name": "idx_discount_codes_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_discount_codes_code_tenant": { - "name": "uq_discount_codes_code_tenant", - "columns": [ - "upper(code)", - "tenant_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "discount_codes_tenant_id_tenants_id_fk": { - "name": "discount_codes_tenant_id_tenants_id_fk", - "tableFrom": "discount_codes", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "document_review_items": { - "name": "document_review_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "document_key": { - "name": "document_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_requested": { - "name": "is_requested", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_received": { - "name": "is_received", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_reviewed": { - "name": "is_reviewed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_na": { - "name": "is_na", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_doc_review_inspection": { - "name": "idx_doc_review_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_doc_review_item": { - "name": "uq_doc_review_item", - "columns": [ - "inspection_id", - "document_key" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_suppressions": { - "name": "email_suppressions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_provider": { - "name": "source_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_event_id": { - "name": "provider_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_email_suppressions_email": { - "name": "idx_email_suppressions_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "erasure_log": { - "name": "erasure_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject_email": { - "name": "subject_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "requested_by": { - "name": "requested_by", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "identity_basis": { - "name": "identity_basis", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "decisions_json": { - "name": "decisions_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retained_count": { - "name": "retained_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "anonymized_count": { - "name": "anonymized_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "deleted_count": { - "name": "deleted_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "response_note": { - "name": "response_note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_erasure_log_tenant": { - "name": "idx_erasure_log_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "esign_audit_logs": { - "name": "esign_audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event": { - "name": "event", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload_json": { - "name": "payload_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "hash": { - "name": "hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_esign_audit_logs_request": { - "name": "idx_esign_audit_logs_request", - "columns": [ - "tenant_id", - "request_id", - "created_at" - ], - "isUnique": false - }, - "idx_esign_audit_logs_event_dedup": { - "name": "idx_esign_audit_logs_event_dedup", - "columns": [ - "tenant_id", - "request_id", - "event" - ], - "isUnique": true, - "where": "event NOT LIKE 'signer.%'" - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "event_types": { - "name": "event_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "default_duration_min": { - "name": "default_duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "default_price_cents": { - "name": "default_price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'#6366f1'" - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_event_types_tenant_slug": { - "name": "uq_event_types_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": { - "event_types_tenant_id_tenants_id_fk": { - "name": "event_types_tenant_id_tenants_id_fk", - "tableFrom": "event_types", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_access_tokens": { - "name": "inspection_access_tokens", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_email": { - "name": "recipient_email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'client'" - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_iat_token": { - "name": "idx_iat_token", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_iat_inspection": { - "name": "idx_iat_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_iat_recipient": { - "name": "idx_iat_recipient", - "columns": [ - "inspection_id", - "recipient_email" - ], - "isUnique": true - }, - "idx_iat_token_hash": { - "name": "idx_iat_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_access_tokens_tenant_id_tenants_id_fk": { - "name": "inspection_access_tokens_tenant_id_tenants_id_fk", - "tableFrom": "inspection_access_tokens", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_events": { - "name": "inspection_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "event_type_id": { - "name": "event_type_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'scheduled'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "completed_at": { - "name": "completed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "results_received_at": { - "name": "results_received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancelled_at": { - "name": "cancelled_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "gcal_event_id": { - "name": "gcal_event_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_events_scheduled": { - "name": "idx_inspection_events_scheduled", - "columns": [ - "tenant_id", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_events_inspection": { - "name": "idx_inspection_events_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_events_tenant_id_tenants_id_fk": { - "name": "inspection_events_tenant_id_tenants_id_fk", - "tableFrom": "inspection_events", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspection_id_inspections_id_fk": { - "name": "inspection_events_inspection_id_inspections_id_fk", - "tableFrom": "inspection_events", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_events_event_type_id_event_types_id_fk": { - "name": "inspection_events_event_type_id_event_types_id_fk", - "tableFrom": "inspection_events", - "tableTo": "event_types", - "columnsFrom": [ - "event_type_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_events_inspector_id_users_id_fk": { - "name": "inspection_events_inspector_id_users_id_fk", - "tableFrom": "inspection_events", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_inspectors": { - "name": "inspection_inspectors", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'lead'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_inspectors_tenant_user": { - "name": "idx_insp_inspectors_tenant_user", - "columns": [ - "tenant_id", - "user_id" - ], - "isUnique": false - }, - "idx_insp_inspectors_user": { - "name": "idx_insp_inspectors_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_inspectors_inspection_id_user_id_pk": { - "columns": [ - "inspection_id", - "user_id" - ], - "name": "inspection_inspectors_inspection_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_item_tag_links": { - "name": "inspection_item_tag_links", - "columns": { - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_id": { - "name": "item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tag_id": { - "name": "tag_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tag_links_tenant": { - "name": "idx_tag_links_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_tag_links_tag": { - "name": "idx_tag_links_tag", - "columns": [ - "tag_id" - ], - "isUnique": false - }, - "idx_tag_links_inspection_item": { - "name": "idx_tag_links_inspection_item", - "columns": [ - "inspection_id", - "item_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "inspection_item_tag_links_inspection_id_item_id_tag_id_pk": { - "columns": [ - "inspection_id", - "item_id", - "tag_id" - ], - "name": "inspection_item_tag_links_inspection_id_item_id_tag_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_media_pool": { - "name": "inspection_media_pool", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "url": { - "name": "url", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_at": { - "name": "uploaded_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "exif_data": { - "name": "exif_data", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "annotations": { - "name": "annotations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "caption": { - "name": "caption", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "media_type": { - "name": "media_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'photo'" - }, - "stream_uid": { - "name": "stream_uid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "poster_pct": { - "name": "poster_pct", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_sec": { - "name": "duration_sec", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'stream'" - }, - "poster_key": { - "name": "poster_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_media_pool_tenant": { - "name": "idx_media_pool_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_media_pool_inspection": { - "name": "idx_media_pool_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_messages": { - "name": "inspection_messages", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_role": { - "name": "from_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "from_name": { - "name": "from_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "attachments": { - "name": "attachments", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_msg_inspection": { - "name": "idx_msg_inspection", - "columns": [ - "inspection_id", - "created_at" - ], - "isUnique": false - }, - "idx_msg_unread": { - "name": "idx_msg_unread", - "columns": [ - "tenant_id", - "inspection_id", - "from_role" - ], - "isUnique": false, - "where": "\"inspection_messages\".\"read_at\" IS NULL" - } - }, - "foreignKeys": { - "inspection_messages_tenant_id_tenants_id_fk": { - "name": "inspection_messages_tenant_id_tenants_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_messages_inspection_id_inspections_id_fk": { - "name": "inspection_messages_inspection_id_inspections_id_fk", - "tableFrom": "inspection_messages", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_people": { - "name": "inspection_people", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role_profile_id": { - "name": "role_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_ip_inspection": { - "name": "idx_ip_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_ip_tenant": { - "name": "idx_ip_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_ip_insp_contact_role": { - "name": "uq_ip_insp_contact_role", - "columns": [ - "inspection_id", - "contact_id", - "role_profile_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_requests": { - "name": "inspection_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_phone": { - "name": "client_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "property_city": { - "name": "property_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_state": { - "name": "property_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_zip": { - "name": "property_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_at": { - "name": "scheduled_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "total_amount_cents": { - "name": "total_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_requests_tenant": { - "name": "idx_inspection_requests_tenant", - "columns": [ - "tenant_id", - "status", - "scheduled_at" - ], - "isUnique": false - }, - "idx_inspection_requests_email": { - "name": "idx_inspection_requests_email", - "columns": [ - "tenant_id", - "client_email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_requests_tenant_id_tenants_id_fk": { - "name": "inspection_requests_tenant_id_tenants_id_fk", - "tableFrom": "inspection_requests", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_results": { - "name": "inspection_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "data": { - "name": "data", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ydoc_state": { - "name": "ydoc_state", - "type": "blob", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rating_system_snapshot": { - "name": "rating_system_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_results_tenant": { - "name": "idx_results_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_results_inspection": { - "name": "idx_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "uq_results_inspection": { - "name": "uq_results_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": true - } - }, - "foreignKeys": { - "inspection_results_tenant_id_tenants_id_fk": { - "name": "inspection_results_tenant_id_tenants_id_fk", - "tableFrom": "inspection_results", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_results_inspection_id_inspections_id_fk": { - "name": "inspection_results_inspection_id_inspections_id_fk", - "tableFrom": "inspection_results", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_services": { - "name": "inspection_services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_override_cents": { - "name": "price_override_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "name_snapshot": { - "name": "name_snapshot", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "price_snapshot_cents": { - "name": "price_snapshot_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_insp_services_tenant": { - "name": "idx_insp_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_insp_services_insp": { - "name": "idx_insp_services_insp", - "columns": [ - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspection_services_tenant_id_tenants_id_fk": { - "name": "inspection_services_tenant_id_tenants_id_fk", - "tableFrom": "inspection_services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspection_services_inspection_id_inspections_id_fk": { - "name": "inspection_services_inspection_id_inspections_id_fk", - "tableFrom": "inspection_services", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "inspection_services_service_id_services_id_fk": { - "name": "inspection_services_service_id_services_id_fk", - "tableFrom": "inspection_services", - "tableTo": "services", - "columnsFrom": [ - "service_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_types": { - "name": "inspection_types", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "based_on": { - "name": "based_on", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_types_tenant_name": { - "name": "idx_inspection_types_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspection_units": { - "name": "inspection_units", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "parent_unit_id": { - "name": "parent_unit_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unit'" - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "attrs": { - "name": "attrs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspection_units_tenant_inspection": { - "name": "idx_inspection_units_tenant_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_inspection_units_parent": { - "name": "idx_inspection_units_parent", - "columns": [ - "parent_unit_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspections": { - "name": "inspections", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_id": { - "name": "inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_address": { - "name": "property_address", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "address_place_id": { - "name": "address_place_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_street": { - "name": "address_street", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_city": { - "name": "address_city", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_state": { - "name": "address_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_zip": { - "name": "address_zip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_county": { - "name": "address_county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lat": { - "name": "address_lat", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_lng": { - "name": "address_lng", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "address_geocoded_at": { - "name": "address_geocoded_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'requested'" - }, - "report_status": { - "name": "report_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'in_progress'" - }, - "payment_status": { - "name": "payment_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'unpaid'" - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "confirmed_at": { - "name": "confirmed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_reason": { - "name": "cancel_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cancel_notes": { - "name": "cancel_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_payment_required": { - "name": "is_payment_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_agreement_required": { - "name": "is_agreement_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_auto_sign_on_publish": { - "name": "is_auto_sign_on_publish", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "discount_code_id": { - "name": "discount_code_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "discount_amount_cents": { - "name": "discount_amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "closing_date": { - "name": "closing_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "referral_source": { - "name": "referral_source", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reference_number": { - "name": "reference_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "internal_notes": { - "name": "internal_notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "year_built": { - "name": "year_built", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sqft": { - "name": "sqft", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "foundation_type": { - "name": "foundation_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bedrooms": { - "name": "bedrooms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "bathrooms": { - "name": "bathrooms", - "type": "real", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "lot_size": { - "name": "lot_size", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_facts": { - "name": "property_facts", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_photo_id": { - "name": "cover_photo_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_crop": { - "name": "cover_crop", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "cover_image_key": { - "name": "cover_image_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit": { - "name": "unit", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_tier": { - "name": "report_tier", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "county": { - "name": "county", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_automations_disabled": { - "name": "is_automations_disabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "template_snapshot": { - "name": "template_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_snapshot_version": { - "name": "template_snapshot_version", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false, - "default": 1 - }, - "profile_override": { - "name": "profile_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "require_defect_fields_override": { - "name": "require_defect_fields_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "request_id": { - "name": "request_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "concierge_status": { - "name": "concierge_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_team_mode": { - "name": "is_team_mode", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "lead_inspector_id": { - "name": "lead_inspector_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "helper_inspector_ids": { - "name": "helper_inspector_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "data_version": { - "name": "data_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "source_inspection_id": { - "name": "source_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "root_inspection_id": { - "name": "root_inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reinspection_round": { - "name": "reinspection_round", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "unit_inspection_mode": { - "name": "unit_inspection_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'tagged'" - }, - "location_options": { - "name": "location_options", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sampling_declaration": { - "name": "sampling_declaration", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "pca_narrative": { - "name": "pca_narrative", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deviations": { - "name": "deviations", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_mode": { - "name": "report_photo_mode", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_start_ms": { - "name": "scheduled_start_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "scheduled_end_ms": { - "name": "scheduled_end_ms", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "duration_min": { - "name": "duration_min", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "badge_layout_override": { - "name": "badge_layout_override", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "report_photo_columns": { - "name": "report_photo_columns", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_inspections_tenant": { - "name": "idx_inspections_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspections_request": { - "name": "idx_inspections_request", - "columns": [ - "request_id" - ], - "isUnique": false - }, - "idx_inspections_inspector": { - "name": "idx_inspections_inspector", - "columns": [ - "inspector_id" - ], - "isUnique": false - }, - "idx_inspections_tenant_status": { - "name": "idx_inspections_tenant_status", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_inspections_tenant_date": { - "name": "idx_inspections_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_inspector_date": { - "name": "idx_inspections_inspector_date", - "columns": [ - "inspector_id", - "date" - ], - "isUnique": false - }, - "idx_inspections_root": { - "name": "idx_inspections_root", - "columns": [ - "root_inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "inspections_tenant_id_tenants_id_fk": { - "name": "inspections_tenant_id_tenants_id_fk", - "tableFrom": "inspections", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_inspector_id_users_id_fk": { - "name": "inspections_inspector_id_users_id_fk", - "tableFrom": "inspections", - "tableTo": "users", - "columnsFrom": [ - "inspector_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_template_id_templates_id_fk": { - "name": "inspections_template_id_templates_id_fk", - "tableFrom": "inspections", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_discount_code_id_discount_codes_id_fk": { - "name": "inspections_discount_code_id_discount_codes_id_fk", - "tableFrom": "inspections", - "tableTo": "discount_codes", - "columnsFrom": [ - "discount_code_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "inspections_request_id_inspection_requests_id_fk": { - "name": "inspections_request_id_inspection_requests_id_fk", - "tableFrom": "inspections", - "tableTo": "inspection_requests", - "columnsFrom": [ - "request_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "inspector_credentials": { - "name": "inspector_credentials", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "member_number": { - "name": "member_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "image_r2_key": { - "name": "image_r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_inspector_credentials_tenant": { - "name": "idx_inspector_credentials_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_inspector_credentials_user": { - "name": "idx_inspector_credentials_user", - "columns": [ - "user_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "invoices": { - "name": "invoices", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_name": { - "name": "client_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "client_email": { - "name": "client_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "amount_cents": { - "name": "amount_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "line_items": { - "name": "line_items", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "due_date": { - "name": "due_date", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "notes": { - "name": "notes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "paid_at": { - "name": "paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "payment_method": { - "name": "payment_method", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "partial_paid_at": { - "name": "partial_paid_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "voided_at": { - "name": "voided_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qbo_sync_status": { - "name": "qbo_sync_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": { - "idx_invoices_tenant": { - "name": "idx_invoices_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_invoices_inspection": { - "name": "idx_invoices_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_invoices_contact": { - "name": "idx_invoices_contact", - "columns": [ - "tenant_id", - "contact_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "invoices_tenant_id_tenants_id_fk": { - "name": "invoices_tenant_id_tenants_id_fk", - "tableFrom": "invoices", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_inspection_id_inspections_id_fk": { - "name": "invoices_inspection_id_inspections_id_fk", - "tableFrom": "invoices", - "tableTo": "inspections", - "columnsFrom": [ - "inspection_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "invoices_contact_id_contacts_id_fk": { - "name": "invoices_contact_id_contacts_id_fk", - "tableFrom": "invoices", - "tableTo": "contacts", - "columnsFrom": [ - "contact_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_libraries": { - "name": "marketplace_libraries", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "kind": { - "name": "kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_libraries_kind_featured": { - "name": "idx_marketplace_libraries_kind_featured", - "columns": [ - "kind", - "is_featured" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "marketplace_templates": { - "name": "marketplace_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "semver": { - "name": "semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "author_id": { - "name": "author_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'system'" - }, - "changelog": { - "name": "changelog", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "download_count": { - "name": "download_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "message_templates": { - "name": "message_templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "channel": { - "name": "channel", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "variables": { - "name": "variables", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seeded": { - "name": "is_seeded", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_message_templates_tenant_channel": { - "name": "idx_message_templates_tenant_channel", - "columns": [ - "tenant_id", - "channel" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "messaging_compliance": { - "name": "messaging_compliance", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "mode": { - "name": "mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'own'" - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "subaccount_sid": { - "name": "subaccount_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_sid": { - "name": "customer_profile_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "customer_profile_status": { - "name": "customer_profile_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_sid": { - "name": "brand_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "brand_status": { - "name": "brand_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_sid": { - "name": "campaign_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "campaign_status": { - "name": "campaign_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_sid": { - "name": "tfv_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tfv_status": { - "name": "tfv_status", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "messaging_resource_sid": { - "name": "messaging_resource_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provider_meta": { - "name": "provider_meta", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number": { - "name": "provisioned_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "provisioned_number_sid": { - "name": "provisioned_number_sid", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "has_sender_attached": { - "name": "has_sender_attached", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "compliance_status": { - "name": "compliance_status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'not_started'" - }, - "rejection_reason": { - "name": "rejection_reason", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "observer_links": { - "name": "observer_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token": { - "name": "token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_viewed_at": { - "name": "last_viewed_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_hash": { - "name": "token_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "token_enc": { - "name": "token_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "observer_links_token_unique": { - "name": "observer_links_token_unique", - "columns": [ - "token" - ], - "isUnique": true - }, - "idx_observer_links_inspection": { - "name": "idx_observer_links_inspection", - "columns": [ - "inspection_id" - ], - "isUnique": false - }, - "idx_observer_links_token_hash": { - "name": "idx_observer_links_token_hash", - "columns": [ - "token_hash" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "orphaned_media": { - "name": "orphaned_media", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "first_seen_at": { - "name": "first_seen_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_orphaned_media_key": { - "name": "idx_orphaned_media_key", - "columns": [ - "tenant_id", - "r2_key" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_webhook_events": { - "name": "processed_webhook_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "psq_responses": { - "name": "psq_responses", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "responses": { - "name": "responses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'sent'" - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sent_at": { - "name": "sent_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_psq_inspection": { - "name": "uq_psq_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": true - }, - "idx_psq_share_token": { - "name": "idx_psq_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_connections": { - "name": "qbo_connections", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "realm_id": { - "name": "realm_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "access_token_enc": { - "name": "access_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_enc": { - "name": "refresh_token_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "token_expires_at": { - "name": "token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "refresh_token_expires_at": { - "name": "refresh_token_expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_sync_at": { - "name": "last_sync_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_sync_enabled": { - "name": "is_sync_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "default_item_id": { - "name": "default_item_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'1'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_entity_map": { - "name": "qbo_entity_map", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_type": { - "name": "qbo_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_id": { - "name": "qbo_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "qbo_sync_token": { - "name": "qbo_sync_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "synced_at": { - "name": "synced_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_qbo_entity_map_qbo": { - "name": "idx_qbo_entity_map_qbo", - "columns": [ - "tenant_id", - "qbo_type", - "qbo_id" - ], - "isUnique": true - }, - "idx_qbo_entity_map_oi": { - "name": "idx_qbo_entity_map_oi", - "columns": [ - "tenant_id", - "oi_type", - "oi_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "qbo_sync_errors": { - "name": "qbo_sync_errors", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_type": { - "name": "oi_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "oi_id": { - "name": "oi_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_msg": { - "name": "error_msg", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "retries": { - "name": "retries", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "is_resolved": { - "name": "is_resolved", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "rating_systems": { - "name": "rating_systems", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "levels": { - "name": "levels", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_default": { - "name": "is_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_rating_systems_tenant_slug": { - "name": "idx_rating_systems_tenant_slug", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_rating_systems_tenant": { - "name": "idx_rating_systems_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "rating_systems_tenant_id_tenants_id_fk": { - "name": "rating_systems_tenant_id_tenants_id_fk", - "tableFrom": "rating_systems", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_request_items": { - "name": "repair_request_items", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "repair_request_id": { - "name": "repair_request_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "finding_key": { - "name": "finding_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "section_title": { - "name": "section_title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "item_label": { - "name": "item_label", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "comment_snapshot": { - "name": "comment_snapshot", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "requested_credit_cents": { - "name": "requested_credit_cents", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "note": { - "name": "note", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "idx_repair_request_items_rr": { - "name": "idx_repair_request_items_rr", - "columns": [ - "repair_request_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "repair_requests": { - "name": "repair_requests", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_kind": { - "name": "created_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by_ref": { - "name": "created_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "custom_intro": { - "name": "custom_intro", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "share_token": { - "name": "share_token", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_repair_requests_inspection": { - "name": "idx_repair_requests_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "idx_repair_requests_share_token": { - "name": "idx_repair_requests_share_token", - "columns": [ - "share_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_exports": { - "name": "report_exports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "format": { - "name": "format", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_report_exports_inspection": { - "name": "idx_report_exports_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_pdfs": { - "name": "report_pdfs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rendered_at": { - "name": "rendered_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'ready'" - }, - "error": { - "name": "error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "uq_report_pdfs_inspection_type": { - "name": "uq_report_pdfs_inspection_type", - "columns": [ - "inspection_id", - "type", - "version_number" - ], - "isUnique": true - }, - "idx_report_pdfs_tenant": { - "name": "idx_report_pdfs_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_report_pdfs_status": { - "name": "idx_report_pdfs_status", - "columns": [ - "status" - ], - "isUnique": false - }, - "idx_report_pdfs_content_hash": { - "name": "idx_report_pdfs_content_hash", - "columns": [ - "inspection_id", - "type", - "content_hash" - ], - "isUnique": false - } - }, - "foreignKeys": { - "report_pdfs_tenant_id_tenants_id_fk": { - "name": "report_pdfs_tenant_id_tenants_id_fk", - "tableFrom": "report_pdfs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_signoff": { - "name": "report_signoff", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "person_id": { - "name": "person_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "license": { - "name": "license", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "qualifications_ref": { - "name": "qualifications_ref", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signed_at": { - "name": "signed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "signature_ref": { - "name": "signature_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "is_dual_role": { - "name": "is_dual_role", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - } - }, - "indexes": { - "idx_report_signoff_inspection": { - "name": "idx_report_signoff_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - }, - "uq_report_signoff_role": { - "name": "uq_report_signoff_role", - "columns": [ - "inspection_id", - "role" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "report_versions": { - "name": "report_versions", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version_number": { - "name": "version_number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "snapshot_json": { - "name": "snapshot_json", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "summary": { - "name": "summary", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "content_hash": { - "name": "content_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "prev_hash": { - "name": "prev_hash", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "signature": { - "name": "signature", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "key_fingerprint": { - "name": "key_fingerprint", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_amendment": { - "name": "is_amendment", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "verification_token": { - "name": "verification_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_by": { - "name": "published_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_report_versions_inspection": { - "name": "idx_report_versions_inspection", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": false - }, - "uq_report_versions_inspection_version": { - "name": "uq_report_versions_inspection_version", - "columns": [ - "inspection_id", - "version_number" - ], - "isUnique": true - }, - "idx_report_versions_verify_token": { - "name": "idx_report_versions_verify_token", - "columns": [ - "verification_token" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "service_inspectors": { - "name": "service_inspectors", - "columns": { - "service_id": { - "name": "service_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_service_inspectors_tenant": { - "name": "idx_service_inspectors_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "service_inspectors_service_id_user_id_pk": { - "columns": [ - "service_id", - "user_id" - ], - "name": "service_inspectors_service_id_user_id_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "services": { - "name": "services", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "price_cents": { - "name": "price_cents", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "duration_minutes": { - "name": "duration_minutes", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "agreement_id": { - "name": "agreement_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_active": { - "name": "is_active", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_services_tenant": { - "name": "idx_services_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "services_tenant_id_tenants_id_fk": { - "name": "services_tenant_id_tenants_id_fk", - "tableFrom": "services", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_template_id_templates_id_fk": { - "name": "services_template_id_templates_id_fk", - "tableFrom": "services", - "tableTo": "templates", - "columnsFrom": [ - "template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "services_agreement_id_agreements_id_fk": { - "name": "services_agreement_id_agreements_id_fk", - "tableFrom": "services", - "tableTo": "agreements", - "columnsFrom": [ - "agreement_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "signing_keys": { - "name": "signing_keys", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "public_key": { - "name": "public_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_enc": { - "name": "private_key_enc", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "private_key_iv": { - "name": "private_key_iv", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "fingerprint": { - "name": "fingerprint", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "algorithm": { - "name": "algorithm", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'Ed25519'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rotated_at": { - "name": "rotated_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "signing_keys_tenant_id_tenants_id_fk": { - "name": "signing_keys_tenant_id_tenants_id_fk", - "tableFrom": "signing_keys", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_consent_log": { - "name": "sms_consent_log", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "contact_id": { - "name": "contact_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "recipient_type": { - "name": "recipient_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "disclosure_version": { - "name": "disclosure_version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "captured_via": { - "name": "captured_via", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "ip": { - "name": "ip", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "user_agent": { - "name": "user_agent", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_consent_contact": { - "name": "idx_sms_consent_contact", - "columns": [ - "tenant_id", - "contact_id", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_delivery_status": { - "name": "sms_delivery_status", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider_message_id": { - "name": "provider_message_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "error_code": { - "name": "error_code", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_sms_delivery_status_msg": { - "name": "idx_sms_delivery_status_msg", - "columns": [ - "tenant_id", - "provider_message_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sms_disclosure_versions": { - "name": "sms_disclosure_versions", - "columns": { - "version": { - "name": "version", - "type": "integer", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "text": { - "name": "text", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "published_at": { - "name": "published_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tags": { - "name": "tags", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "color": { - "name": "color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_seed": { - "name": "is_seed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_tags_tenant_name": { - "name": "idx_tags_tenant_name", - "columns": [ - "tenant_id", - "name" - ], - "isUnique": true - }, - "idx_tags_tenant": { - "name": "idx_tags_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "templates": { - "name": "templates", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "version": { - "name": "version", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 1 - }, - "schema": { - "name": "schema", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "rating_system_id": { - "name": "rating_system_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "property_type": { - "name": "property_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "commercial_subtype": { - "name": "commercial_subtype", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_featured": { - "name": "is_featured", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "default_profile_id": { - "name": "default_profile_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_templates_tenant": { - "name": "idx_templates_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_templates_rating_system": { - "name": "idx_templates_rating_system", - "columns": [ - "rating_system_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "templates_tenant_id_tenants_id_fk": { - "name": "templates_tenant_id_tenants_id_fk", - "tableFrom": "templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_custom_holidays": { - "name": "tenant_custom_holidays", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "date": { - "name": "date", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "uq_tenant_custom_holidays_tenant_date": { - "name": "uq_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": true - }, - "idx_tenant_custom_holidays_tenant_date": { - "name": "idx_tenant_custom_holidays_tenant_date", - "columns": [ - "tenant_id", - "date" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_library_imports": { - "name": "tenant_library_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "row_count": { - "name": "row_count", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - } - }, - "indexes": { - "uq_tenant_library_import": { - "name": "uq_tenant_library_import", - "columns": [ - "tenant_id", - "library_id" - ], - "isUnique": true - }, - "idx_tenant_library_imports_tenant": { - "name": "idx_tenant_library_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_import_history": { - "name": "tenant_marketplace_import_history", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "library_id": { - "name": "library_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "template_id": { - "name": "template_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "source_version": { - "name": "source_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "target_version": { - "name": "target_version", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_affected": { - "name": "rows_affected", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_by": { - "name": "created_by", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_marketplace_history_tenant": { - "name": "idx_marketplace_history_tenant", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_marketplace_history_template": { - "name": "idx_marketplace_history_template", - "columns": [ - "template_id" - ], - "isUnique": false - }, - "idx_marketplace_history_library": { - "name": "idx_marketplace_history_library", - "columns": [ - "library_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_marketplace_imports": { - "name": "tenant_marketplace_imports", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "marketplace_template_id": { - "name": "marketplace_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_semver": { - "name": "imported_semver", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "local_template_id": { - "name": "local_template_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "imported_at": { - "name": "imported_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_mkt_imports_tmpl": { - "name": "idx_mkt_imports_tmpl", - "columns": [ - "marketplace_template_id" - ], - "isUnique": false - }, - "idx_mkt_imports_tenant": { - "name": "idx_mkt_imports_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk": { - "name": "tenant_marketplace_imports_marketplace_template_id_marketplace_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "marketplace_templates", - "columnsFrom": [ - "marketplace_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "tenant_marketplace_imports_local_template_id_templates_id_fk": { - "name": "tenant_marketplace_imports_local_template_id_templates_id_fk", - "tableFrom": "tenant_marketplace_imports", - "tableTo": "templates", - "columnsFrom": [ - "local_template_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "usage_counters": { - "name": "usage_counters", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "metric": { - "name": "metric", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "period_key": { - "name": "period_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "value": { - "name": "value", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_usage_counters_tenant": { - "name": "idx_usage_counters_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": { - "usage_counters_tenant_id_metric_period_key_pk": { - "columns": [ - "tenant_id", - "metric", - "period_key" - ], - "name": "usage_counters_tenant_id_metric_period_key_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "user_identity_links": { - "name": "user_identity_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "primary_user_id": { - "name": "primary_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_user_id": { - "name": "linked_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_tenant_id": { - "name": "linked_tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_role": { - "name": "linked_role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "linked_display_name": { - "name": "linked_display_name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)" - } - }, - "indexes": { - "idx_user_identity_links_primary": { - "name": "idx_user_identity_links_primary", - "columns": [ - "primary_user_id" - ], - "isUnique": false - }, - "uq_user_identity_links_primary_linked": { - "name": "uq_user_identity_links_primary_linked", - "columns": [ - "primary_user_id", - "linked_user_id" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "email_templates": { - "name": "email_templates", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "trigger": { - "name": "trigger", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "subject": { - "name": "subject", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "blocks": { - "name": "blocks", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_enabled": { - "name": "is_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "email_templates_tenant_id_tenants_id_fk": { - "name": "email_templates_tenant_id_tenants_id_fk", - "tableFrom": "email_templates", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "email_templates_tenant_id_trigger_pk": { - "columns": [ - "tenant_id", - "trigger" - ], - "name": "email_templates_tenant_id_trigger_pk" - } - }, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_configs": { - "name": "tenant_configs", - "columns": { - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "company_name": { - "name": "company_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "primary_color": { - "name": "primary_color", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "logo_url": { - "name": "logo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "support_email": { - "name": "support_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_address": { - "name": "company_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_pdf_footer_shown": { - "name": "is_pdf_footer_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_page_numbers_shown": { - "name": "is_pdf_page_numbers_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_pdf_license_shown": { - "name": "is_pdf_license_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "sender_email": { - "name": "sender_email", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "reply_to": { - "name": "reply_to", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_mode": { - "name": "email_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "video_mode": { - "name": "video_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'r2'" - }, - "sms_mode": { - "name": "sms_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'platform'" - }, - "sender_display_name": { - "name": "sender_display_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "point_of_contact": { - "name": "point_of_contact", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'company'" - }, - "billing_url": { - "name": "billing_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "review_url": { - "name": "review_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "company_phone": { - "name": "company_phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "integration_config": { - "name": "integration_config", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "secrets_enc": { - "name": "secrets_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dek_enc": { - "name": "dek_enc", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ics_token": { - "name": "ics_token", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "widget_allowed_origins": { - "name": "widget_allowed_origins", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_profile_id": { - "name": "default_profile_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'signature'" - }, - "attention_thresholds": { - "name": "attention_thresholds", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'{\"agreement_unsigned_h\":72,\"invoice_overdue_h\":72,\"report_unpublished_h\":72}'" - }, - "inspection_prefs": { - "name": "inspection_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_estimates_shown": { - "name": "is_estimates_shown", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_repair_list_enabled": { - "name": "is_repair_list_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_customer_repair_export_enabled": { - "name": "is_customer_repair_export_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unpaid_blocked": { - "name": "is_unpaid_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_unsigned_agreement_blocked": { - "name": "is_unsigned_agreement_blocked", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "custom_referral_sources": { - "name": "custom_referral_sources", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "dashboard_column_prefs": { - "name": "dashboard_column_prefs", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_concierge_review_required": { - "name": "is_concierge_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_inspector_choice_allowed": { - "name": "is_inspector_choice_allowed", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_pdf_pipeline_enabled": { - "name": "is_pdf_pipeline_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_team_mode_default": { - "name": "is_team_mode_default", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_apprentice_review_required": { - "name": "is_apprentice_review_required", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "is_guest_invites_enabled": { - "name": "is_guest_invites_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "require_defect_fields": { - "name": "require_defect_fields", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'none'" - }, - "agreement_retention_years": { - "name": "agreement_retention_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 6 - }, - "reinspection_statuses": { - "name": "reinspection_statuses", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_collab_editing_enabled": { - "name": "is_collab_editing_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "sms_byo_provider": { - "name": "sms_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email_byo_provider": { - "name": "email_byo_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'resend'" - }, - "is_managed_eligible": { - "name": "is_managed_eligible", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "managed_provider": { - "name": "managed_provider", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'twilio'" - }, - "is_reserve_schedule_enabled": { - "name": "is_reserve_schedule_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "reserve_term_years": { - "name": "reserve_term_years", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 12 - }, - "inflation_rate_bps": { - "name": "inflation_rate_bps", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_timezone": { - "name": "default_timezone", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'UTC'" - }, - "booking_slot_mode": { - "name": "booking_slot_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'fixed'" - }, - "booking_slot_interval_min": { - "name": "booking_slot_interval_min", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 30 - }, - "holiday_region": { - "name": "holiday_region", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "holiday_public_policy": { - "name": "holiday_public_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'open'" - }, - "holiday_internal_policy": { - "name": "holiday_internal_policy", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'advisory'" - }, - "default_locale": { - "name": "default_locale", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'en-US'" - }, - "currency": { - "name": "currency", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'USD'" - } - }, - "indexes": {}, - "foreignKeys": { - "tenant_configs_tenant_id_tenants_id_fk": { - "name": "tenant_configs_tenant_id_tenants_id_fk", - "tableFrom": "tenant_configs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenants": { - "name": "tenants", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tier": { - "name": "tier", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'free'" - }, - "stripe_connect_account_id": { - "name": "stripe_connect_account_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "max_users": { - "name": "max_users", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 5 - }, - "deployment_mode": { - "name": "deployment_mode", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'shared'" - }, - "applied_cmd_seq": { - "name": "applied_cmd_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "applied_cred_seq": { - "name": "applied_cred_seq", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "tenants_slug_unique": { - "name": "tenants_slug_unique", - "columns": [ - "slug" - ], - "isUnique": true - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_invites": { - "name": "agent_invites", - "columns": { - "token": { - "name": "token", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "accepted_at": { - "name": "accepted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_invites_email": { - "name": "idx_agent_invites_email", - "columns": [ - "email" - ], - "isUnique": false - }, - "idx_agent_invites_tenant": { - "name": "idx_agent_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_agent_invites_expiration": { - "name": "idx_agent_invites_expiration", - "columns": [ - "expires_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_invites_tenant_id_tenants_id_fk": { - "name": "agent_invites_tenant_id_tenants_id_fk", - "tableFrom": "agent_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_invites_invited_by_user_id_users_id_fk": { - "name": "agent_invites_invited_by_user_id_users_id_fk", - "tableFrom": "agent_invites", - "tableTo": "users", - "columnsFrom": [ - "invited_by_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_invites": { - "name": "tenant_invites", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'inspector'" - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_invites_tenant": { - "name": "idx_invites_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "uq_tenant_invites_pending_email": { - "name": "uq_tenant_invites_pending_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "status = 'pending'" - } - }, - "foreignKeys": { - "tenant_invites_tenant_id_tenants_id_fk": { - "name": "tenant_invites_tenant_id_tenants_id_fk", - "tableFrom": "tenant_invites", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "users": { - "name": "users", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "email": { - "name": "email", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "password_hash": { - "name": "password_hash", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "phone": { - "name": "phone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "license_number": { - "name": "license_number", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "photo_url": { - "name": "photo_url", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "default_signature_base64": { - "name": "default_signature_base64", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_signature_enabled": { - "name": "is_signature_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "slug": { - "name": "slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "role": { - "name": "role", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'manager'" - }, - "onboarding_state": { - "name": "onboarding_state", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "totp_secret": { - "name": "totp_secret", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_totp_enabled": { - "name": "is_totp_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "totp_recovery_codes": { - "name": "totp_recovery_codes", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "totp_verified_at": { - "name": "totp_verified_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_referral_notification_enabled": { - "name": "is_referral_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_report_notification_enabled": { - "name": "is_report_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "is_paid_notification_enabled": { - "name": "is_paid_notification_enabled", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": false - }, - "last_active_at": { - "name": "last_active_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "mentor_id": { - "name": "mentor_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "assigned_section_ids": { - "name": "assigned_section_ids", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'[]'" - }, - "expires_at": { - "name": "expires_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "deleted_at": { - "name": "deleted_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "terms_accepted": { - "name": "terms_accepted", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "permission_overrides": { - "name": "permission_overrides", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "timezone": { - "name": "timezone", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "locale": { - "name": "locale", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_users_deleted_at": { - "name": "idx_users_deleted_at", - "columns": [ - "deleted_at" - ], - "isUnique": false - }, - "uq_users_tenant_email": { - "name": "uq_users_tenant_email", - "columns": [ - "tenant_id", - "email" - ], - "isUnique": true, - "where": "deleted_at IS NULL" - }, - "idx_users_tenant": { - "name": "idx_users_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_users_slug_per_tenant": { - "name": "idx_users_slug_per_tenant", - "columns": [ - "tenant_id", - "slug" - ], - "isUnique": true - }, - "idx_users_email": { - "name": "idx_users_email", - "columns": [ - "email" - ], - "isUnique": false - } - }, - "foreignKeys": { - "users_tenant_id_tenants_id_fk": { - "name": "users_tenant_id_tenants_id_fk", - "tableFrom": "users", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "agent_tenant_links": { - "name": "agent_tenant_links", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "agent_user_id": { - "name": "agent_user_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspector_contact_id": { - "name": "inspector_contact_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'active'" - }, - "invited_by_user_id": { - "name": "invited_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "revoked_at": { - "name": "revoked_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_agent_tenant_unique": { - "name": "idx_agent_tenant_unique", - "columns": [ - "agent_user_id", - "tenant_id" - ], - "isUnique": true - }, - "idx_agent_tenant_by_tenant": { - "name": "idx_agent_tenant_by_tenant", - "columns": [ - "tenant_id", - "status" - ], - "isUnique": false - }, - "idx_agent_tenant_by_agent": { - "name": "idx_agent_tenant_by_agent", - "columns": [ - "agent_user_id", - "status" - ], - "isUnique": false - } - }, - "foreignKeys": { - "agent_tenant_links_agent_user_id_users_id_fk": { - "name": "agent_tenant_links_agent_user_id_users_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "users", - "columnsFrom": [ - "agent_user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "agent_tenant_links_tenant_id_tenants_id_fk": { - "name": "agent_tenant_links_tenant_id_tenants_id_fk", - "tableFrom": "agent_tenant_links", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "audit_logs": { - "name": "audit_logs", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "action": { - "name": "action", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "ip_address": { - "name": "ip_address", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "inspector_slug": { - "name": "inspector_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_audit_tenant_created": { - "name": "idx_audit_tenant_created", - "columns": [ - "tenant_id", - "created_at" - ], - "isUnique": false - }, - "idx_audit_entity": { - "name": "idx_audit_entity", - "columns": [ - "entity_type", - "entity_id" - ], - "isUnique": false - } - }, - "foreignKeys": { - "audit_logs_tenant_id_tenants_id_fk": { - "name": "audit_logs_tenant_id_tenants_id_fk", - "tableFrom": "audit_logs", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "integration_test_results": { - "name": "integration_test_results", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "target": { - "name": "target", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "provider": { - "name": "provider", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "is_ok": { - "name": "is_ok", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "detail": { - "name": "detail", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_by_user_id": { - "name": "tested_by_user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "tested_at": { - "name": "tested_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_integration_test_tenant_target": { - "name": "idx_integration_test_tenant_target", - "columns": [ - "tenant_id", - "target", - "tested_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "notifications": { - "name": "notifications", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "user_id": { - "name": "user_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "type": { - "name": "type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "title": { - "name": "title", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "body": { - "name": "body", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_type": { - "name": "entity_type", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "entity_id": { - "name": "entity_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "metadata": { - "name": "metadata", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "read_at": { - "name": "read_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "archived_at": { - "name": "archived_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_notifications_tenant_user_created": { - "name": "idx_notifications_tenant_user_created", - "columns": [ - "tenant_id", - "user_id", - "created_at" - ], - "isUnique": false - }, - "idx_notifications_tenant_user_unread": { - "name": "idx_notifications_tenant_user_unread", - "columns": [ - "tenant_id", - "user_id", - "read_at" - ], - "isUnique": false - } - }, - "foreignKeys": { - "notifications_tenant_id_tenants_id_fk": { - "name": "notifications_tenant_id_tenants_id_fk", - "tableFrom": "notifications", - "tableTo": "tenants", - "columnsFrom": [ - "tenant_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "notifications_user_id_users_id_fk": { - "name": "notifications_user_id_users_id_fk", - "tableFrom": "notifications", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "parked_cmd_events": { - "name": "parked_cmd_events", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "envelope": { - "name": "envelope", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "received_at": { - "name": "received_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_parked_cmd_events_received_at": { - "name": "idx_parked_cmd_events_received_at", - "columns": [ - "received_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "processed_cmd_events": { - "name": "processed_cmd_events", - "columns": { - "event_id": { - "name": "event_id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "cmd_type": { - "name": "cmd_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "processed_at": { - "name": "processed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "slug_reservations": { - "name": "slug_reservations", - "columns": { - "slug": { - "name": "slug", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "reason": { - "name": "reason", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "sync_outbox": { - "name": "sync_outbox", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "event_type": { - "name": "event_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "payload": { - "name": "payload", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "attempts": { - "name": "attempts", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "last_tried_at": { - "name": "last_tried_at", - "type": "integer", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "last_error": { - "name": "last_error", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - } - }, - "indexes": { - "idx_sync_outbox_status_created": { - "name": "idx_sync_outbox_status_created", - "columns": [ - "status", - "created_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "tenant_destruction_records": { - "name": "tenant_destruction_records", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "tenant_slug": { - "name": "tenant_slug", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "rows_deleted": { - "name": "rows_deleted", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_objects": { - "name": "r2_objects", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "r2_bytes": { - "name": "r2_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "kv_keys": { - "name": "kv_keys", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": 0 - }, - "destroyed_at": { - "name": "destroyed_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_destruction_tenant": { - "name": "idx_destruction_tenant", - "columns": [ - "tenant_id" - ], - "isUnique": false - }, - "idx_destruction_destroyed_at": { - "name": "idx_destruction_destroyed_at", - "columns": [ - "destroyed_at" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "client_uploads": { - "name": "client_uploads", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "tenant_id": { - "name": "tenant_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "inspection_id": { - "name": "inspection_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_kind": { - "name": "uploaded_by_kind", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_ref": { - "name": "uploaded_by_ref", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "uploaded_by_name": { - "name": "uploaded_by_name", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "category": { - "name": "category", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "visibility": { - "name": "visibility", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "r2_key": { - "name": "r2_key", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "filename": { - "name": "filename", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "content_type": { - "name": "content_type", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "size_bytes": { - "name": "size_bytes", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": { - "idx_client_uploads_inspection": { - "name": "idx_client_uploads_inspection", - "columns": [ - "tenant_id", - "inspection_id" - ], - "isUnique": false - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - } - }, - "views": {}, - "enums": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "internal": { - "indexes": { - "uq_discount_codes_code_tenant": { - "columns": { - "upper(code)": { - "isExpression": true - } - } - } - } - } -} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index 4d5911186..d7dd04bd1 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -5,142 +5,9 @@ { "idx": 0, "version": "6", - "when": 1783955772843, + "when": 1784630456652, "tag": "0000_baseline", "breakpoints": true - }, - { - "idx": 1, - "version": "6", - "when": 1783994575393, - "tag": "0001_boolean_columns_is_has", - "breakpoints": true - }, - { - "idx": 2, - "version": "6", - "when": 1784000415747, - "tag": "0002_timezone_columns", - "breakpoints": true - }, - { - "idx": 3, - "version": "6", - "when": 1784035151899, - "tag": "0003_fine_marrow", - "breakpoints": true - }, - { - "idx": 4, - "version": "6", - "when": 1784170453120, - "tag": "0004_far_quicksilver", - "breakpoints": true - }, - { - "idx": 5, - "version": "6", - "when": 1784175185970, - "tag": "0005_flaky_romulus", - "breakpoints": true - }, - { - "idx": 6, - "version": "6", - "when": 1784176137404, - "tag": "0006_old_doomsday", - "breakpoints": true - }, - { - "idx": 7, - "version": "6", - "when": 1784198482703, - "tag": "0007_large_exiles", - "breakpoints": true - }, - { - "idx": 8, - "version": "6", - "when": 1784207480662, - "tag": "0008_swift_stryfe", - "breakpoints": true - }, - { - "idx": 9, - "version": "6", - "when": 1784286920455, - "tag": "0009_aspiring_mathemanic", - "breakpoints": true - }, - { - "idx": 10, - "version": "6", - "when": 1784334758784, - "tag": "0010_broad_bishop", - "breakpoints": true - }, - { - "idx": 11, - "version": "6", - "when": 1784337027884, - "tag": "0011_light_stark_industries", - "breakpoints": true - }, - { - "idx": 12, - "version": "6", - "when": 1784338953390, - "tag": "0012_minor_ares", - "breakpoints": true - }, - { - "idx": 13, - "version": "6", - "when": 1784376226829, - "tag": "0013_futuristic_tyger_tiger", - "breakpoints": true - }, - { - "idx": 14, - "version": "6", - "when": 1784407155886, - "tag": "0014_large_marvel_apes", - "breakpoints": true - }, - { - "idx": 15, - "version": "6", - "when": 1784437957348, - "tag": "0015_automations_recipient_discriminator", - "breakpoints": true - }, - { - "idx": 16, - "version": "6", - "when": 1784443471778, - "tag": "0016_tiny_wrecker", - "breakpoints": true - }, - { - "idx": 17, - "version": "6", - "when": 1784447370356, - "tag": "0017_ambiguous_stephen_strange", - "breakpoints": true - }, - { - "idx": 18, - "version": "6", - "when": 1784561350840, - "tag": "0018_report_style_profiles", - "breakpoints": true - }, - { - "idx": 19, - "version": "6", - "when": 1784567253565, - "tag": "0019_black_payback", - "breakpoints": true } ] } \ No newline at end of file