Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

Outbound calls behind a per-workspace switch, domestic numbers only (PR 1978)

Tim Gutberlet3156f51d99c3
diff --git a/apps/api/src/call-guide.ts b/apps/api/src/call-guide.ts
index 6a787ed2..10bdf989 100644
--- a/apps/api/src/call-guide.ts
+++ b/apps/api/src/call-guide.ts
@@ -11,6 +11,7 @@ import { and, eq, isNull } from 'drizzle-orm'
import type { Actor } from './context.ts'
import { db } from './db.ts'
import { type Handler, NotFound, type Preparer, Reject } from './handler-context.ts'
+import { outboundCallsEnabled } from './outbound-call.ts'
import { livekitToken } from './livekit-status.ts'
type Env = Record<string, string | undefined>
@@ -63,6 +64,7 @@ export function callGuidePreparers(deps: () => Deps = () => ({})): Record<string
const { env = process.env, send = livekitGuideSender(env) } = deps()
const workspaceId = actor.workspaceId
if (!workspaceId) throw new Reject('no workspace (send x-workspace-id)')
+ if (!(await outboundCallsEnabled(db, workspaceId))) throw Reject.t('server.api.dial.notEnabled')
const [call] = await db
.select({ id: calls.id, source: calls.source, ended_at: calls.ended_at, room: calls.room })
.from(calls)
diff --git a/apps/api/src/handlers.ts b/apps/api/src/handlers.ts
index 860f869f..fc92e99a 100644
--- a/apps/api/src/handlers.ts
+++ b/apps/api/src/handlers.ts
@@ -1,5 +1,12 @@
// Server side of the registry. Patch actions run generically; the rest have a handler here.
-import { DIALS_PER_DAY, DIALS_PER_MINUTE, outboundCallHandlers, outboundCallPreparers } from './outbound-call.ts'
+import {
+ DIALS_PER_DAY,
+ DIALS_PER_MINUTE,
+ domesticRefusal,
+ outboundCallHandlers,
+ outboundCallPreparers,
+ outboundCallsEnabled,
+} from './outbound-call.ts'
import { callGuideHandlers, callGuidePreparers } from './call-guide.ts'
import {
type CallQuality,
@@ -1543,7 +1550,10 @@ const handlers: Record<string, Handler> = {
.limit(1)
const business = (own ?? number).e164
// Checked again here, where the call is filed: the API decides at dial time, as for transfers.
+ if (!(await outboundCallsEnabled(tx, actor.workspaceId))) throw Reject.t('server.api.dial.notEnabled')
if (!isE164(input.to)) throw Reject.t('server.api.dial.invalidNumber')
+ const foreign = domesticRefusal(business, input.to)
+ if (foreign) throw foreign
const route = await numberRoute(tx, actor.workspaceId, business)
const refusal = await outboundRefusal(tx, actor.workspaceId, input.to, 'call', { strict: true, route })
if (refusal) throw new Reject(refusal)
diff --git a/apps/api/src/outbound-call.ts b/apps/api/src/outbound-call.ts
index 24e0f729..1744a8ab 100644
--- a/apps/api/src/outbound-call.ts
+++ b/apps/api/src/outbound-call.ts
@@ -3,8 +3,8 @@
// metadata says whom to call and why. The metadata is set here with the install's LiveKit key, so nobody else can
// write it. The agent registers the call (call.startOutbound) and dials out through the same trunk as warm transfers
// (apps/agent/src/outbound-dial.ts); from there on it is an ordinary call: transcript, summary, call-end webhook.
-import { type OutboundDialMetadata, isE164 } from '@linedesk/actions'
-import { assistants, phone_numbers } from '@linedesk/db'
+import { type OutboundDialMetadata, isE164, phoneCountry } from '@linedesk/actions'
+import { assistants, phone_numbers, workspace_settings } from '@linedesk/db'
import { and, asc, eq } from 'drizzle-orm'
import { randomUUID } from 'node:crypto'
import { assistantForNumber } from './assistants.ts'
@@ -16,6 +16,22 @@ import { createRateLimiter } from './rate-limit.ts'
type Env = Record<string, string | undefined>
+/** Whether a server admin turned outbound calls on for the workspace (workspace_settings.outbound_calls_enabled). */
+export async function outboundCallsEnabled(tx: Pick<typeof db, 'select'>, workspaceId: string): Promise<boolean> {
+ const [row] = await tx
+ .select({ on: workspace_settings.outbound_calls_enabled })
+ .from(workspace_settings)
+ .where(eq(workspace_settings.workspace_id, workspaceId))
+ return row?.on === true
+}
+
+/** Calls stay in the country of the number they come from (Tim, 2026-11-28): no international outbound calls. */
+export function domesticRefusal(from: string, to: string): Reject | null {
+ const a = phoneCountry(from)
+ const b = phoneCountry(to)
+ return a && b && a === b ? null : Reject.t('server.api.dial.notDomestic')
+}
+
/** The voice agent's name (apps/agent/src/env.ts); it only joins rooms it is dispatched to by name. */
const AGENT_NAME = 'linedesk'
/** Outbound calls one workspace may start: a few a minute, more over the day (each costs money and reaches a person). */
@@ -76,12 +92,15 @@ export function outboundCallPreparers(deps: () => Deps = () => ({})): Record<str
const { env = process.env, dispatch = livekitDispatcher(env), now = Date.now } = deps()
const workspaceId = actor.workspaceId
if (!workspaceId) throw new Reject('no workspace (send x-workspace-id)')
+ if (!(await outboundCallsEnabled(db, workspaceId))) throw Reject.t('server.api.dial.notEnabled')
if (!dispatch) throw Reject.t('server.api.dial.unavailable')
const to = input.to.replace(/[\s().-]/g, '')
if (!isE164(to)) throw Reject.t('server.api.dial.invalidNumber')
const from = await caller(workspaceId, input.assistantId)
if (!from) throw Reject.t('server.api.dial.noNumber')
if (to === from.from) throw Reject.t('server.api.dial.ownNumber')
+ const foreign = domesticRefusal(from.from, to)
+ if (foreign) throw foreign
const refusal = await outboundRefusal(db, workspaceId, to, 'call', {
strict: true,
env,
@@ -109,6 +128,16 @@ export function outboundCallPreparers(deps: () => Deps = () => ({})): Record<str
}
export const outboundCallHandlers: Record<string, Handler> = {
+ // A server admin turns outbound calls on or off for one workspace (the setting row exists for every workspace).
+ 'workspace.setOutboundCalls': async ({ tx }, input: { workspaceId: string; enabled: boolean }) => {
+ const [row] = await tx
+ .update(workspace_settings)
+ .set({ outbound_calls_enabled: input.enabled })
+ .where(eq(workspace_settings.workspace_id, input.workspaceId))
+ .returning()
+ if (!row) throw Reject.t('server.api.noSuchWorkspace')
+ return { rows: {}, data: { workspaceId: input.workspaceId, enabled: input.enabled } }
+ },
// Everything happened in the preparer (the dispatch is a network call, kept out of the transaction).
'call.dial': async ({ prepared }) => ({ rows: {}, data: prepared as DialResult }),
}
diff --git a/apps/api/test/call-guide.test.ts b/apps/api/test/call-guide.test.ts
index 6789861e..13d8b405 100644
--- a/apps/api/test/call-guide.test.ts
+++ b/apps/api/test/call-guide.test.ts
@@ -3,7 +3,7 @@
import { createHmac, randomUUID } from 'node:crypto'
import { CALL_GUIDE_TOPIC, callGuideSigned } from '@linedesk/actions'
-import { calls, transcript_segments } from '@linedesk/db'
+import { calls, transcript_segments, workspace_settings } from '@linedesk/db'
import { eq } from 'drizzle-orm'
import { afterAll, beforeAll, expect, test, vi } from 'vitest'
import { db } from '../src/db.ts'
@@ -37,7 +37,16 @@ beforeAll(async () => {
return realFetch(url, init)
})
ws = await createWorkspace('Brightwater Plumbing & Heating')
+ // Outbound calls are off until a server admin turns them on (workspace.setOutboundCalls).
+ await db
+ .update(workspace_settings)
+ .set({ outbound_calls_enabled: true })
+ .where(eq(workspace_settings.workspace_id, ws.id))
other = await createWorkspace('Other Business')
+ await db
+ .update(workspace_settings)
+ .set({ outbound_calls_enabled: true })
+ .where(eq(workspace_settings.workspace_id, other.id))
member = await addMember(ws.id, 'member')
admin = await addMember(ws.id, 'admin')
room = `outbound-${randomUUID()}`
diff --git a/apps/api/test/outbound-calls.test.ts b/apps/api/test/outbound-calls.test.ts
index 300ec8d4..685dc3d8 100644
--- a/apps/api/test/outbound-calls.test.ts
+++ b/apps/api/test/outbound-calls.test.ts
@@ -1,6 +1,6 @@
// Outbound AI calls (call.dial, LIN-873): an owner's or admin's key asks the assistant to phone someone; the API starts
// the agent through a LiveKit dispatch, and the agent registers the call as outbound (call.startOutbound).
-import { calls } from '@linedesk/db'
+import { calls, workspace_settings } from '@linedesk/db'
import { eq } from 'drizzle-orm'
import { afterAll, beforeAll, expect, test, vi } from 'vitest'
import { db } from '../src/db.ts'
@@ -28,6 +28,11 @@ beforeAll(async () => {
return realFetch(url, init)
})
ws = await createWorkspace('Brightwater Plumbing & Heating')
+ // Outbound calls are off until a server admin turns them on (workspace.setOutboundCalls).
+ await db
+ .update(workspace_settings)
+ .set({ outbound_calls_enabled: true })
+ .where(eq(workspace_settings.workspace_id, ws.id))
member = await addMember(ws.id, 'member')
})
afterAll(() => {
@@ -82,3 +87,13 @@ test('the agent registers the dialled call once, as outbound from the business n
const again = await act(agent(ws.id), 'call.startOutbound', { room, assistantId: ws.assistant.id, to })
expect(again.status).toBe(409)
})
+
+test('outbound calls stay off until a server admin turns them on, and stay in the country of the number', async () => {
+ const off = await createWorkspace('Not turned on')
+ const refused = await act(off.owner, 'call.dial', { to: randomNumber(), goal, first_sentence: firstSentence })
+ expect(refused.status).toBe(409)
+ expect(refused.body.error).toMatch(/not turned on/)
+ // The workspace's number is a +1 number: a German number is abroad.
+ const abroad = await act(ws.owner, 'call.dial', { to: '+4915112345678', goal, first_sentence: firstSentence })
+ expect(abroad.status).toBe(409)
+})
diff --git a/packages/actions/src/calls.ts b/packages/actions/src/calls.ts
index 6d9889ae..61aa0cdc 100644
--- a/packages/actions/src/calls.ts
+++ b/packages/actions/src/calls.ts
@@ -311,6 +311,16 @@ export type CallGuidePacket = { instruction: string; at: string; by: string | nu
export const callGuideSigned = (room: string, packet: Omit<CallGuidePacket, 'sig'>) =>
JSON.stringify([room, packet.at, packet.by, packet.instruction])
+/** Outbound AI calls for one workspace on or off (LIN-873): only server admins; off for every new workspace. */
+export const workspaceSetOutboundCalls = defineAction({
+ name: 'workspace.setOutboundCalls',
+ // i18n-ignore: API and MCP docs for agents and developers, not shown in the app
+ description:
+ 'Turn outbound AI calls (call.dial, call.guide, the Outbound calls page) on or off for a workspace. Server admins only; every workspace starts with them off.',
+ input: z.object({ workspaceId: z.string().min(1), enabled: z.boolean() }),
+ permission: 'instance:admin',
+})
+
/** What the voice agent reads from the job metadata of a room `call.dial` started (apps/api/src/outbound-call.ts). */
export type OutboundDialMetadata = {
source: 'outbound'
diff --git a/packages/actions/src/index.ts b/packages/actions/src/index.ts
index d5c549d7..f9421cc1 100644
--- a/packages/actions/src/index.ts
+++ b/packages/actions/src/index.ts
@@ -165,6 +165,7 @@ const all = [
calls.callFlagUrgent,
calls.callStartTest,
calls.callDial,
+ calls.workspaceSetOutboundCalls,
calls.callGuide,
calls.callStartOutbound,
calls.callFindForTest,
diff --git a/packages/actions/src/rights.test.ts b/packages/actions/src/rights.test.ts
index 77d75230..f080b921 100644
--- a/packages/actions/src/rights.test.ts
+++ b/packages/actions/src/rights.test.ts
@@ -238,6 +238,8 @@ const expectedRights: Record<Right, readonly string[]> = {
'shopify.changeOrder',
],
'server-admin': [
+ // Outbound AI calls per workspace (LIN-873).
+ 'workspace.setOutboundCalls',
'voiceCloning.get',
'voiceCloning.set',
// German numbers held in the install's name (number-buy.ts).
@@ -458,7 +460,9 @@ describe('workspace rights', () => {
it('members change no workspace setting: settings, team, keys and webhooks are for admins', () => {
for (const name of expectedRights.member) {
const def = actions.get(name)!
- expect(['settings:write', 'team:write', 'workspace:own', 'call:export', 'call:dial'], name).not.toContain(def.permission)
+ expect(['settings:write', 'team:write', 'workspace:own', 'call:export', 'call:dial'], name).not.toContain(
+ def.permission,
+ )
}
})
diff --git a/packages/db/migrations/0190_outbound_calls_enabled.sql b/packages/db/migrations/0190_outbound_calls_enabled.sql
new file mode 100644
index 00000000..96e3a717
--- /dev/null
+++ b/packages/db/migrations/0190_outbound_calls_enabled.sql
@@ -0,0 +1 @@
+ALTER TABLE "workspace_settings" ADD COLUMN "outbound_calls_enabled" boolean DEFAULT false NOT NULL;
\ No newline at end of file
diff --git a/packages/db/migrations/meta/0190_snapshot.json b/packages/db/migrations/meta/0190_snapshot.json
new file mode 100644
index 00000000..993b2093
--- /dev/null
+++ b/packages/db/migrations/meta/0190_snapshot.json
@@ -0,0 +1,11313 @@
+{
+ "id": "5062e26a-bba2-417c-9fce-5dd73f36a707",
+ "prevId": "3d09dbfa-b3a7-4ea3-bc45-3191a5953ca6",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.admin_authenticators": {
+ "name": "admin_authenticators",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "confirmed_at": {
+ "name": "confirmed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_step": {
+ "name": "last_step",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_attempts": {
+ "name": "failed_attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "locked_until": {
+ "name": "locked_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "admin_authenticators_user_id_user_id_fk": {
+ "name": "admin_authenticators_user_id_user_id_fk",
+ "tableFrom": "admin_authenticators",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.admin_devices": {
+ "name": "admin_devices",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_hash": {
+ "name": "device_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "admin_devices_user_id_user_id_fk": {
+ "name": "admin_devices_user_id_user_id_fk",
+ "tableFrom": "admin_devices",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "admin_devices_user_id_device_hash_pk": {
+ "name": "admin_devices_user_id_device_hash_pk",
+ "columns": [
+ "user_id",
+ "device_hash"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_setup_counts": {
+ "name": "agent_setup_counts",
+ "schema": "",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client": {
+ "name": "client",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "made": {
+ "name": "made",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "connected": {
+ "name": "connected",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "agent_setup_counts_day_kind_client_pk": {
+ "name": "agent_setup_counts_day_kind_client_pk",
+ "columns": [
+ "day",
+ "kind",
+ "client"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_setup_keys": {
+ "name": "agent_setup_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_reason": {
+ "name": "ended_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "passkey_confirmed_until": {
+ "name": "passkey_confirmed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client": {
+ "name": "client",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_at": {
+ "name": "connected_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "agent_setup_keys_creator": {
+ "name": "agent_setup_keys_creator",
+ "columns": [
+ {
+ "expression": "created_by",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_setup_keys_workspace_id_organization_id_fk": {
+ "name": "agent_setup_keys_workspace_id_organization_id_fk",
+ "tableFrom": "agent_setup_keys",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_setup_keys_partner_id_partners_id_fk": {
+ "name": "agent_setup_keys_partner_id_partners_id_fk",
+ "tableFrom": "agent_setup_keys",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_setup_keys_key_hash_unique": {
+ "name": "agent_setup_keys_key_hash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key_hash"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.api_keys": {
+ "name": "api_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_impersonator": {
+ "name": "created_by_impersonator",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "api_keys_ws": {
+ "name": "api_keys_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "api_keys_key_hash_unique": {
+ "name": "api_keys_key_hash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key_hash"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_connections": {
+ "name": "app_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_name": {
+ "name": "account_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connected'"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failures": {
+ "name": "failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_push_at": {
+ "name": "last_push_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_by": {
+ "name": "connected_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "settings": {
+ "name": "settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "app_connections_ws": {
+ "name": "app_connections_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "app_connections_app": {
+ "name": "app_connections_app",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "provider"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_credentials": {
+ "name": "app_credentials",
+ "schema": "",
+ "columns": {
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "webhook_url_encrypted": {
+ "name": "webhook_url_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "app_credentials_connection_id_app_connections_id_fk": {
+ "name": "app_credentials_connection_id_app_connections_id_fk",
+ "tableFrom": "app_credentials",
+ "tableTo": "app_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_oauth_states": {
+ "name": "app_oauth_states",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_pushes": {
+ "name": "app_pushes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "record_id": {
+ "name": "record_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "app_pushes_connection": {
+ "name": "app_pushes_connection",
+ "columns": [
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "app_pushes_open": {
+ "name": "app_pushes_open",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"app_pushes\".\"status\" in ('pending', 'sending')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "app_pushes_connection_id_app_connections_id_fk": {
+ "name": "app_pushes_connection_id_app_connections_id_fk",
+ "tableFrom": "app_pushes",
+ "tableTo": "app_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "app_pushes_call_id_calls_id_fk": {
+ "name": "app_pushes_call_id_calls_id_fk",
+ "tableFrom": "app_pushes",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "app_pushes_call": {
+ "name": "app_pushes_call",
+ "nullsNotDistinct": false,
+ "columns": [
+ "connection_id",
+ "call_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_setup_requests": {
+ "name": "app_setup_requests",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "shop": {
+ "name": "shop",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requested_by": {
+ "name": "requested_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'requested'"
+ },
+ "install_url": {
+ "name": "install_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure": {
+ "name": "failure",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "app_setup_requests_open": {
+ "name": "app_setup_requests_open",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"app_setup_requests\".\"status\" <> 'connected'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "app_setup_requests_shop": {
+ "name": "app_setup_requests_shop",
+ "columns": [
+ {
+ "expression": "shop",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.appointment_types": {
+ "name": "appointment_types",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "duration_min": {
+ "name": "duration_min",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "buffer_min": {
+ "name": "buffer_min",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "buffer_before_min": {
+ "name": "buffer_before_min",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "buffer_after_min": {
+ "name": "buffer_after_min",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "book_when": {
+ "name": "book_when",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'business_hours'"
+ },
+ "min_notice_hours": {
+ "name": "min_notice_hours",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "max_days_ahead": {
+ "name": "max_days_ahead",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 60
+ },
+ "location": {
+ "name": "location",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'on_site'"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "required_fields": {
+ "name": "required_fields",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "name_required": {
+ "name": "name_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "instruction": {
+ "name": "instruction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "appointment_types_ws": {
+ "name": "appointment_types_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "appointment_types_duration": {
+ "name": "appointment_types_duration",
+ "value": "\"appointment_types\".\"duration_min\" > 0"
+ },
+ "appointment_types_buffer": {
+ "name": "appointment_types_buffer",
+ "value": "\"appointment_types\".\"buffer_min\" >= 0"
+ },
+ "appointment_types_buffer_before": {
+ "name": "appointment_types_buffer_before",
+ "value": "\"appointment_types\".\"buffer_before_min\" >= 0"
+ },
+ "appointment_types_buffer_after": {
+ "name": "appointment_types_buffer_after",
+ "value": "\"appointment_types\".\"buffer_after_min\" >= 0"
+ },
+ "appointment_types_min_notice": {
+ "name": "appointment_types_min_notice",
+ "value": "\"appointment_types\".\"min_notice_hours\" >= 0"
+ },
+ "appointment_types_max_days": {
+ "name": "appointment_types_max_days",
+ "value": "\"appointment_types\".\"max_days_ahead\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.assistant_calendars": {
+ "name": "assistant_calendars",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assistant_id": {
+ "name": "assistant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "instruction": {
+ "name": "instruction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "duration_min": {
+ "name": "duration_min",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "assistant_calendars_ws": {
+ "name": "assistant_calendars_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "assistant_calendars_assistant_id_assistants_id_fk": {
+ "name": "assistant_calendars_assistant_id_assistants_id_fk",
+ "tableFrom": "assistant_calendars",
+ "tableTo": "assistants",
+ "columnsFrom": [
+ "assistant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "assistant_calendars_connection_id_calendar_connections_id_fk": {
+ "name": "assistant_calendars_connection_id_calendar_connections_id_fk",
+ "tableFrom": "assistant_calendars",
+ "tableTo": "calendar_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "assistant_calendars_calendar": {
+ "name": "assistant_calendars_calendar",
+ "nullsNotDistinct": false,
+ "columns": [
+ "assistant_id",
+ "connection_id",
+ "external_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.assistant_versions": {
+ "name": "assistant_versions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assistant_id": {
+ "name": "assistant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "settings": {
+ "name": "settings",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "changed_by": {
+ "name": "changed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "restored_from": {
+ "name": "restored_from",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "assistant_versions_ws": {
+ "name": "assistant_versions_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "assistant_versions_assistant_id_assistants_id_fk": {
+ "name": "assistant_versions_assistant_id_assistants_id_fk",
+ "tableFrom": "assistant_versions",
+ "tableTo": "assistants",
+ "columnsFrom": [
+ "assistant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "assistant_versions_number": {
+ "name": "assistant_versions_number",
+ "nullsNotDistinct": false,
+ "columns": [
+ "assistant_id",
+ "number"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.assistants": {
+ "name": "assistants",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'Maya'"
+ },
+ "greeting": {
+ "name": "greeting",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "ai_disclosure": {
+ "name": "ai_disclosure",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'at_start'"
+ },
+ "communication_style": {
+ "name": "communication_style",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "record_calls": {
+ "name": "record_calls",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "greet_by_name": {
+ "name": "greet_by_name",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "greeting_known_caller": {
+ "name": "greeting_known_caller",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "voice": {
+ "name": "voice",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"provider\":\"elevenlabs\",\"voice_id\":\"\"}'::jsonb"
+ },
+ "llm_model": {
+ "name": "llm_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "business_profile": {
+ "name": "business_profile",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "call_rules": {
+ "name": "call_rules",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "greeting_outside": {
+ "name": "greeting_outside",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instructions_outside": {
+ "name": "instructions_outside",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfers": {
+ "name": "transfers",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[{\"id\":\"person\",\"name\":\"Owner\",\"number\":null,\"condition\":\"The caller asks to speak to a person\",\"hours_only\":true,\"ring_seconds\":25,\"if_no_answer\":\"message\",\"enabled\":true}]'::jsonb"
+ },
+ "transfer_urgent": {
+ "name": "transfer_urgent",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "transfer_number": {
+ "name": "transfer_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_hours_only": {
+ "name": "transfer_hours_only",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "silence_first_gap_s": {
+ "name": "silence_first_gap_s",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 8
+ },
+ "silence_reminders": {
+ "name": "silence_reminders",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 2
+ },
+ "silence_hang_up_s": {
+ "name": "silence_hang_up_s",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 24
+ },
+ "max_call_minutes": {
+ "name": "max_call_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 20
+ },
+ "silence_closing": {
+ "name": "silence_closing",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "silence_reminder": {
+ "name": "silence_reminder",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goodbye_line": {
+ "name": "goodbye_line",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "talking_speed": {
+ "name": "talking_speed",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'normal'"
+ },
+ "talking_speed_pct": {
+ "name": "talking_speed_pct",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 100
+ },
+ "behaviours": {
+ "name": "behaviours",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "languages": {
+ "name": "languages",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"mode\":\"english\",\"allowed\":[]}'::jsonb"
+ },
+ "call_quality": {
+ "name": "call_quality",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "realtime_voice": {
+ "name": "realtime_voice",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "realtime_model": {
+ "name": "realtime_model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_rules": {
+ "name": "email_rules",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"rules\":[]}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "assistants_ws": {
+ "name": "assistants_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "assistants_max_call_minutes": {
+ "name": "assistants_max_call_minutes",
+ "value": "\"assistants\".\"max_call_minutes\" between 1 and 30"
+ },
+ "assistants_call_quality": {
+ "name": "assistants_call_quality",
+ "value": "\"assistants\".\"call_quality\" in ('standard', 'premium', 'ultra')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.auth_events": {
+ "name": "auth_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "method": {
+ "name": "method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_id": {
+ "name": "subject_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "auth_events_created": {
+ "name": "auth_events_created",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "auth_events_user": {
+ "name": "auth_events_user",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.availability_exceptions": {
+ "name": "availability_exceptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "date": {
+ "name": "date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "time",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "time",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'own'"
+ },
+ "source_key": {
+ "name": "source_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "yearly": {
+ "name": "yearly",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "availability_exceptions_ws_date": {
+ "name": "availability_exceptions_ws_date",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "availability_exceptions_times": {
+ "name": "availability_exceptions_times",
+ "value": "(\"availability_exceptions\".\"start_time\" is null and \"availability_exceptions\".\"end_time\" is null) or coalesce(\"availability_exceptions\".\"end_time\" > \"availability_exceptions\".\"start_time\", false)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.availability_rules": {
+ "name": "availability_rules",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "weekday": {
+ "name": "weekday",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "time",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_time": {
+ "name": "end_time",
+ "type": "time",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "availability_rules_ws": {
+ "name": "availability_rules_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "availability_rules_weekday": {
+ "name": "availability_rules_weekday",
+ "value": "\"availability_rules\".\"weekday\" between 0 and 6"
+ },
+ "availability_rules_times": {
+ "name": "availability_rules_times",
+ "value": "\"availability_rules\".\"end_time\" > \"availability_rules\".\"start_time\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_accounts": {
+ "name": "billing_accounts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending_payment'"
+ },
+ "interval": {
+ "name": "interval",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'month'"
+ },
+ "stripe_customer_id": {
+ "name": "stripe_customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripe_subscription_id": {
+ "name": "stripe_subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_ends_at": {
+ "name": "trial_ends_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_period_start": {
+ "name": "current_period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "current_period_end": {
+ "name": "current_period_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_anchor": {
+ "name": "billing_anchor",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auto_recharge": {
+ "name": "auto_recharge",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "recharge_threshold_cents": {
+ "name": "recharge_threshold_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 500
+ },
+ "recharge_amount_cents": {
+ "name": "recharge_amount_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 2500
+ },
+ "recharge_cap_base_cents": {
+ "name": "recharge_cap_base_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 5000
+ },
+ "trial_recharge_at": {
+ "name": "trial_recharge_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recharge_failed_at": {
+ "name": "recharge_failed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "held_for_review_at": {
+ "name": "held_for_review_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checkout_confirmed_at": {
+ "name": "checkout_confirmed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trial_refused": {
+ "name": "trial_refused",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "card_risk_level": {
+ "name": "card_risk_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "past_due_since": {
+ "name": "past_due_since",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspend_reason": {
+ "name": "suspend_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_from": {
+ "name": "suspended_from",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "concurrent_calls_cap": {
+ "name": "concurrent_calls_cap",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "extra_calls_paid": {
+ "name": "extra_calls_paid",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "extra_calls_paid_until": {
+ "name": "extra_calls_paid_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canceled_at": {
+ "name": "canceled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "past_due_first_payment": {
+ "name": "past_due_first_payment",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_accounts_owner": {
+ "name": "billing_accounts_owner",
+ "columns": [
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "billing_accounts_stripe_customer_id_unique": {
+ "name": "billing_accounts_stripe_customer_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_customer_id"
+ ]
+ },
+ "billing_accounts_stripe_subscription_id_unique": {
+ "name": "billing_accounts_stripe_subscription_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_subscription_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "billing_accounts_kind": {
+ "name": "billing_accounts_kind",
+ "value": "\"billing_accounts\".\"kind\" in ('cloud', 'partner')"
+ },
+ "billing_accounts_status": {
+ "name": "billing_accounts_status",
+ "value": "\"billing_accounts\".\"status\" in ('pending_payment', 'trialing', 'active', 'past_due', 'suspended', 'canceled', 'comped')"
+ },
+ "billing_accounts_interval": {
+ "name": "billing_accounts_interval",
+ "value": "\"billing_accounts\".\"interval\" in ('month', 'year')"
+ },
+ "billing_accounts_trial_refused": {
+ "name": "billing_accounts_trial_refused",
+ "value": "\"billing_accounts\".\"trial_refused\" is null or \"billing_accounts\".\"trial_refused\" in ('card_used', 'prepaid', 'account_used')"
+ },
+ "billing_accounts_recharge_cap_base": {
+ "name": "billing_accounts_recharge_cap_base",
+ "value": "\"billing_accounts\".\"recharge_cap_base_cents\" >= 0"
+ },
+ "billing_accounts_suspend_reason": {
+ "name": "billing_accounts_suspend_reason",
+ "value": "\"billing_accounts\".\"suspend_reason\" is null or \"billing_accounts\".\"suspend_reason\" in ('admin', 'payment', 'dispute', 'early_fraud_warning')"
+ },
+ "billing_accounts_suspended_reason": {
+ "name": "billing_accounts_suspended_reason",
+ "value": "\"billing_accounts\".\"status\" <> 'suspended' or \"billing_accounts\".\"suspend_reason\" is not null"
+ },
+ "billing_accounts_suspended_from": {
+ "name": "billing_accounts_suspended_from",
+ "value": "\"billing_accounts\".\"suspended_from\" is null or \"billing_accounts\".\"suspended_from\" in ('pending_payment', 'trialing', 'active', 'past_due', 'comped')"
+ },
+ "billing_accounts_extra_calls_paid": {
+ "name": "billing_accounts_extra_calls_paid",
+ "value": "\"billing_accounts\".\"extra_calls_paid\" >= 0"
+ },
+ "billing_accounts_concurrent_calls_cap": {
+ "name": "billing_accounts_concurrent_calls_cap",
+ "value": "\"billing_accounts\".\"concurrent_calls_cap\" is null or \"billing_accounts\".\"concurrent_calls_cap\" between 1 and 1000"
+ },
+ "billing_accounts_recharge_threshold": {
+ "name": "billing_accounts_recharge_threshold",
+ "value": "\"billing_accounts\".\"recharge_threshold_cents\" between 500 and 10000"
+ },
+ "billing_accounts_recharge_amount": {
+ "name": "billing_accounts_recharge_amount",
+ "value": "\"billing_accounts\".\"recharge_amount_cents\" between 2000 and 50000"
+ },
+ "billing_accounts_recharge_over_threshold": {
+ "name": "billing_accounts_recharge_over_threshold",
+ "value": "\"billing_accounts\".\"recharge_amount_cents\" >= \"billing_accounts\".\"recharge_threshold_cents\" + 500"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_alerts": {
+ "name": "billing_alerts",
+ "schema": "",
+ "columns": {
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ref": {
+ "name": "ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "billing_alerts_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_alerts_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_alerts",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "billing_alerts_billing_account_id_kind_ref_pk": {
+ "name": "billing_alerts_billing_account_id_kind_ref_pk",
+ "columns": [
+ "billing_account_id",
+ "kind",
+ "ref"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_alerts_kind": {
+ "name": "billing_alerts_kind",
+ "value": "\"billing_alerts\".\"kind\" in ('recharge_failed', 'recharge_cap_reached', 'low_balance', 'renewal_reminder', 'trial_will_end', 'number_unpaid', 'dunning', 'numbers_release', 'numbers_released', 'activation_nudge', 'trial_minutes_low', 'trial_minutes_used', 'busy_line', 'manager_change')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_balances": {
+ "name": "billing_balances",
+ "schema": "",
+ "columns": {
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "balance_micros": {
+ "name": "balance_micros",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "reserved_micros": {
+ "name": "reserved_micros",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "billing_balances_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_balances_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_balances",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_balances_reserved": {
+ "name": "billing_balances_reserved",
+ "value": "\"billing_balances\".\"reserved_micros\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_disputes": {
+ "name": "billing_disputes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "charge_id": {
+ "name": "charge_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credit_entry_id": {
+ "name": "credit_entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "adjustment_entry_id": {
+ "name": "adjustment_entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reversal_entry_id": {
+ "name": "reversal_entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_disputes_bill": {
+ "name": "billing_disputes_bill",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "billing_disputes_charge": {
+ "name": "billing_disputes_charge",
+ "columns": [
+ {
+ "expression": "charge_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_disputes_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_disputes_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_disputes",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_disputes_kind": {
+ "name": "billing_disputes_kind",
+ "value": "\"billing_disputes\".\"kind\" in ('dispute', 'fraud_warning')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_invoices": {
+ "name": "billing_invoices",
+ "schema": "",
+ "columns": {
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "number": {
+ "name": "number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_cents": {
+ "name": "total_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tax_cents": {
+ "name": "tax_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "period_start": {
+ "name": "period_start",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "period_end": {
+ "name": "period_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hosted_invoice_url": {
+ "name": "hosted_invoice_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pdf_url": {
+ "name": "pdf_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_invoices_bill": {
+ "name": "billing_invoices_bill",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_invoices_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_invoices_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_invoices",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_invoices_kind": {
+ "name": "billing_invoices_kind",
+ "value": "\"billing_invoices\".\"kind\" in ('subscription', 'recharge', 'topup')"
+ },
+ "billing_invoices_status": {
+ "name": "billing_invoices_status",
+ "value": "\"billing_invoices\".\"status\" in ('draft', 'open', 'paid', 'uncollectible', 'void')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_numbers": {
+ "name": "billing_numbers",
+ "schema": "",
+ "columns": {
+ "phone_number_id": {
+ "name": "phone_number_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "unpaid_since": {
+ "name": "unpaid_since",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unpaid_period_id": {
+ "name": "unpaid_period_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "port_out_code": {
+ "name": "port_out_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "billing_numbers_bill": {
+ "name": "billing_numbers_bill",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_numbers_phone_number_id_phone_numbers_id_fk": {
+ "name": "billing_numbers_phone_number_id_phone_numbers_id_fk",
+ "tableFrom": "billing_numbers",
+ "tableTo": "phone_numbers",
+ "columnsFrom": [
+ "phone_number_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "billing_numbers_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_numbers_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_numbers",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "billing_numbers_unpaid_period_id_billing_periods_id_fk": {
+ "name": "billing_numbers_unpaid_period_id_billing_periods_id_fk",
+ "tableFrom": "billing_numbers",
+ "tableTo": "billing_periods",
+ "columnsFrom": [
+ "unpaid_period_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "billing_numbers_unpaid": {
+ "name": "billing_numbers_unpaid",
+ "value": "(\"billing_numbers\".\"unpaid_since\" is null) = (\"billing_numbers\".\"unpaid_period_id\" is null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_periods": {
+ "name": "billing_periods",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "starts_at": {
+ "name": "starts_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ends_at": {
+ "name": "ends_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "closed_at": {
+ "name": "closed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "billing_periods_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_periods_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_periods",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "billing_periods_start": {
+ "name": "billing_periods_start",
+ "nullsNotDistinct": false,
+ "columns": [
+ "billing_account_id",
+ "starts_at"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "billing_periods_kind": {
+ "name": "billing_periods_kind",
+ "value": "\"billing_periods\".\"kind\" in ('trial', 'month')"
+ },
+ "billing_periods_range": {
+ "name": "billing_periods_range",
+ "value": "\"billing_periods\".\"ends_at\" > \"billing_periods\".\"starts_at\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_recharges": {
+ "name": "billing_recharges",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_code": {
+ "name": "failure_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "manual": {
+ "name": "manual",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "billing_recharges_one_pending": {
+ "name": "billing_recharges_one_pending",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"billing_recharges\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "billing_recharges_bill_created": {
+ "name": "billing_recharges_bill_created",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_recharges_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_recharges_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_recharges",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "billing_recharges_stripe_invoice_id_unique": {
+ "name": "billing_recharges_stripe_invoice_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "stripe_invoice_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "billing_recharges_status": {
+ "name": "billing_recharges_status",
+ "value": "\"billing_recharges\".\"status\" in ('pending', 'paid', 'failed', 'canceled')"
+ },
+ "billing_recharges_amount": {
+ "name": "billing_recharges_amount",
+ "value": "\"billing_recharges\".\"amount_cents\" between (case when \"billing_recharges\".\"manual\" then 500 else 2000 end) and 50000"
+ },
+ "billing_recharges_resolved": {
+ "name": "billing_recharges_resolved",
+ "value": "(\"billing_recharges\".\"status\" = 'pending') = (\"billing_recharges\".\"resolved_at\" is null)"
+ },
+ "billing_recharges_tax": {
+ "name": "billing_recharges_tax",
+ "value": "\"billing_recharges\".\"tax\" is null or \"billing_recharges\".\"tax\" in ('on', 'off', 'no_address')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.billing_refunds": {
+ "name": "billing_refunds",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "request_id": {
+ "name": "request_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payment_entry_id": {
+ "name": "payment_entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_invoice_id": {
+ "name": "stripe_invoice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stripe_line_id": {
+ "name": "stripe_line_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_cents": {
+ "name": "amount_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_id": {
+ "name": "period_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "credit_note_id": {
+ "name": "credit_note_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refunded_cents": {
+ "name": "refunded_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ledger_entry_id": {
+ "name": "ledger_entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "billing_refunds_bill_status": {
+ "name": "billing_refunds_bill_status",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "billing_refunds_billing_account_id_billing_accounts_id_fk": {
+ "name": "billing_refunds_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "billing_refunds",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "billing_refunds_period_id_billing_periods_id_fk": {
+ "name": "billing_refunds_period_id_billing_periods_id_fk",
+ "tableFrom": "billing_refunds",
+ "tableTo": "billing_periods",
+ "columnsFrom": [
+ "period_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "billing_refunds_request_id_unique": {
+ "name": "billing_refunds_request_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "request_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "billing_refunds_status": {
+ "name": "billing_refunds_status",
+ "value": "\"billing_refunds\".\"status\" in ('pending', 'posted', 'void')"
+ },
+ "billing_refunds_amount": {
+ "name": "billing_refunds_amount",
+ "value": "\"billing_refunds\".\"amount_cents\" > 0"
+ },
+ "billing_refunds_resolved": {
+ "name": "billing_refunds_resolved",
+ "value": "(\"billing_refunds\".\"status\" = 'pending') = (\"billing_refunds\".\"resolved_at\" is null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.bookings": {
+ "name": "bookings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_id": {
+ "name": "contact_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "appointment_type_id": {
+ "name": "appointment_type_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_at": {
+ "name": "start_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_at": {
+ "name": "end_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'confirmed'"
+ },
+ "calendar_id": {
+ "name": "calendar_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "external_event_id": {
+ "name": "external_event_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "calendar_name": {
+ "name": "calendar_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "caller_email": {
+ "name": "caller_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "bookings_ws_start": {
+ "name": "bookings_ws_start",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "start_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "bookings_call_id_calls_id_fk": {
+ "name": "bookings_call_id_calls_id_fk",
+ "tableFrom": "bookings",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "bookings_contact_id_contacts_id_fk": {
+ "name": "bookings_contact_id_contacts_id_fk",
+ "tableFrom": "bookings",
+ "tableTo": "contacts",
+ "columnsFrom": [
+ "contact_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "bookings_appointment_type_id_appointment_types_id_fk": {
+ "name": "bookings_appointment_type_id_appointment_types_id_fk",
+ "tableFrom": "bookings",
+ "tableTo": "appointment_types",
+ "columnsFrom": [
+ "appointment_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "bookings_times": {
+ "name": "bookings_times",
+ "value": "\"bookings\".\"end_at\" > \"bookings\".\"start_at\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.business_lookup_usage": {
+ "name": "business_lookup_usage",
+ "schema": "",
+ "columns": {
+ "day": {
+ "name": "day",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "requests": {
+ "name": "requests",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "business_lookup_usage_day_workspace_id_pk": {
+ "name": "business_lookup_usage_day_workspace_id_pk",
+ "columns": [
+ "day",
+ "workspace_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.calendar_connections": {
+ "name": "calendar_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_email": {
+ "name": "account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connected'"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_by": {
+ "name": "connected_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "calendar_connections_ws": {
+ "name": "calendar_connections_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "calendar_connections_account": {
+ "name": "calendar_connections_account",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "provider",
+ "account_email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.calendar_credentials": {
+ "name": "calendar_credentials",
+ "schema": "",
+ "columns": {
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "calendar_credentials_connection_id_calendar_connections_id_fk": {
+ "name": "calendar_credentials_connection_id_calendar_connections_id_fk",
+ "tableFrom": "calendar_credentials",
+ "tableTo": "calendar_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.calendar_oauth_states": {
+ "name": "calendar_oauth_states",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code_verifier": {
+ "name": "code_verifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.call_evaluations": {
+ "name": "call_evaluations",
+ "schema": "",
+ "columns": {
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "score": {
+ "name": "score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issues": {
+ "name": "issues",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assistant_version": {
+ "name": "assistant_version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unanswered": {
+ "name": "unanswered",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "reviewed_at": {
+ "name": "reviewed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reviewed_by": {
+ "name": "reviewed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "call_evaluations_ws_score": {
+ "name": "call_evaluations_ws_score",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "score",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "call_evaluations_call_id_calls_id_fk": {
+ "name": "call_evaluations_call_id_calls_id_fk",
+ "tableFrom": "call_evaluations",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.call_events": {
+ "name": "call_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "call_events_call": {
+ "name": "call_events_call",
+ "columns": [
+ {
+ "expression": "call_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "call_events_call_id_calls_id_fk": {
+ "name": "call_events_call_id_calls_id_fk",
+ "tableFrom": "call_events",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.call_reservations": {
+ "name": "call_reservations",
+ "schema": "",
+ "columns": {
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reserved_micros": {
+ "name": "reserved_micros",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "usage_level": {
+ "name": "usage_level",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'standard'"
+ },
+ "own_keys": {
+ "name": "own_keys",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "limit_seconds": {
+ "name": "limit_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 3600
+ },
+ "included_reserved_seconds": {
+ "name": "included_reserved_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "call_reservations_call_id_calls_id_fk": {
+ "name": "call_reservations_call_id_calls_id_fk",
+ "tableFrom": "call_reservations",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "call_reservations_billing_account_id_billing_accounts_id_fk": {
+ "name": "call_reservations_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "call_reservations",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "call_reservations_usage_level": {
+ "name": "call_reservations_usage_level",
+ "value": "\"call_reservations\".\"usage_level\" in ('standard', 'premium', 'ultra')"
+ },
+ "call_reservations_limit": {
+ "name": "call_reservations_limit",
+ "value": "\"call_reservations\".\"limit_seconds\" > 0"
+ },
+ "call_reservations_included_reserved": {
+ "name": "call_reservations_included_reserved",
+ "value": "\"call_reservations\".\"included_reserved_seconds\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.calls": {
+ "name": "calls",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_id": {
+ "name": "contact_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "from_number": {
+ "name": "from_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "to_number": {
+ "name": "to_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "direction": {
+ "name": "direction",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'in'"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'phone'"
+ },
+ "from_own_number": {
+ "name": "from_own_number",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "caller_attestation": {
+ "name": "caller_attestation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spam_likely": {
+ "name": "spam_likely",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "duration_sec": {
+ "name": "duration_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'live'"
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "urgency": {
+ "name": "urgency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'normal'"
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action_items": {
+ "name": "action_items",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "fields": {
+ "name": "fields",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "missing_info": {
+ "name": "missing_info",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "answered_by": {
+ "name": "answered_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ai'"
+ },
+ "recording_key": {
+ "name": "recording_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recording_store": {
+ "name": "recording_store",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "room": {
+ "name": "room",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assistant_id": {
+ "name": "assistant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assistant_version": {
+ "name": "assistant_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inbox_state": {
+ "name": "inbox_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "reminder_at": {
+ "name": "reminder_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reminder_label": {
+ "name": "reminder_label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unread": {
+ "name": "unread",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "assignee_id": {
+ "name": "assignee_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_to": {
+ "name": "transfer_to",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_name": {
+ "name": "transfer_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_result": {
+ "name": "transfer_result",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_at": {
+ "name": "transfer_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transfer_seconds": {
+ "name": "transfer_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "booking_misses": {
+ "name": "booking_misses",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "caller_details": {
+ "name": "caller_details",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "voice_failures": {
+ "name": "voice_failures",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "partner_keys": {
+ "name": "partner_keys",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "key_sources": {
+ "name": "key_sources",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "awaiting_transcript_until": {
+ "name": "awaiting_transcript_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "transcript_requested_at": {
+ "name": "transcript_requested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email_route": {
+ "name": "email_route",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "calls_ws_started": {
+ "name": "calls_ws_started",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "calls_deleted": {
+ "name": "calls_deleted",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"calls\".\"deleted_at\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "calls_contact_id_contacts_id_fk": {
+ "name": "calls_contact_id_contacts_id_fk",
+ "tableFrom": "calls",
+ "tableTo": "contacts",
+ "columnsFrom": [
+ "contact_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.card_fingerprints": {
+ "name": "card_fingerprints",
+ "schema": "",
+ "columns": {
+ "fingerprint": {
+ "name": "fingerprint",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "first_billing_account_id": {
+ "name": "first_billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "trial_used_at": {
+ "name": "trial_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "card_fingerprints_first_billing_account_id_billing_accounts_id_fk": {
+ "name": "card_fingerprints_first_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "card_fingerprints",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "first_billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.commands": {
+ "name": "commands",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input": {
+ "name": "input",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_hash": {
+ "name": "input_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result": {
+ "name": "result",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rejected": {
+ "name": "rejected",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "impersonated_by": {
+ "name": "impersonated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "setup_key_id": {
+ "name": "setup_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_key_id": {
+ "name": "personal_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "pruned_at": {
+ "name": "pruned_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "commands_unpruned_created": {
+ "name": "commands_unpruned_created",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"commands\".\"pruned_at\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "commands_unpruned_input": {
+ "name": "commands_unpruned_input",
+ "columns": [
+ {
+ "expression": "input",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "jsonb_path_ops"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"commands\".\"pruned_at\" is null",
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ },
+ "commands_unpruned_result": {
+ "name": "commands_unpruned_result",
+ "columns": [
+ {
+ "expression": "result",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last",
+ "opclass": "jsonb_path_ops"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"commands\".\"pruned_at\" is null",
+ "concurrently": false,
+ "method": "gin",
+ "with": {}
+ },
+ "commands_action_created": {
+ "name": "commands_action_created",
+ "columns": [
+ {
+ "expression": "action",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "commands_impersonated_created": {
+ "name": "commands_impersonated_created",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"commands\".\"impersonated_by\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "commands_setup_key_created": {
+ "name": "commands_setup_key_created",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"commands\".\"setup_key_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contacts": {
+ "name": "contacts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name_source": {
+ "name": "name_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "company": {
+ "name": "company",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "blocked_at": {
+ "name": "blocked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "merged_into": {
+ "name": "merged_into",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "contacts_ws_phone": {
+ "name": "contacts_ws_phone",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "phone",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "contacts_deleted": {
+ "name": "contacts_deleted",
+ "columns": [
+ {
+ "expression": "deleted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"contacts\".\"deleted_at\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.crm_links": {
+ "name": "crm_links",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_id": {
+ "name": "contact_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "crm_links_ws": {
+ "name": "crm_links_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "crm_links_connection_id_app_connections_id_fk": {
+ "name": "crm_links_connection_id_app_connections_id_fk",
+ "tableFrom": "crm_links",
+ "tableTo": "app_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "crm_links_contact_id_contacts_id_fk": {
+ "name": "crm_links_contact_id_contacts_id_fk",
+ "tableFrom": "crm_links",
+ "tableTo": "contacts",
+ "columnsFrom": [
+ "contact_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "crm_links_contact": {
+ "name": "crm_links_contact",
+ "nullsNotDistinct": false,
+ "columns": [
+ "connection_id",
+ "contact_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.feedback": {
+ "name": "feedback",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "via": {
+ "name": "via",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client": {
+ "name": "client",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "page": {
+ "name": "page",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "context": {
+ "name": "context",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "has_screenshot": {
+ "name": "has_screenshot",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "setup_key_id": {
+ "name": "setup_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "report": {
+ "name": "report",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remote_id": {
+ "name": "remote_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tries": {
+ "name": "tries",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "tried_at": {
+ "name": "tried_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "preview_token_hash": {
+ "name": "preview_token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "feedback_actor_created": {
+ "name": "feedback_actor_created",
+ "columns": [
+ {
+ "expression": "actor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "feedback_ws": {
+ "name": "feedback_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "feedback_setup_key": {
+ "name": "feedback_setup_key",
+ "columns": [
+ {
+ "expression": "setup_key_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "feedback_setup_preview_token": {
+ "name": "feedback_setup_preview_token",
+ "columns": [
+ {
+ "expression": "setup_key_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "preview_token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"feedback\".\"preview_token_hash\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "feedback_kind": {
+ "name": "feedback_kind",
+ "value": "\"feedback\".\"kind\" in ('bug', 'feature', 'setup')"
+ },
+ "feedback_via": {
+ "name": "feedback_via",
+ "value": "\"feedback\".\"via\" in ('app', 'api_key', 'personal_key', 'mcp_oauth', 'setup_link')"
+ },
+ "feedback_status": {
+ "name": "feedback_status",
+ "value": "\"feedback\".\"status\" in ('pending', 'sent', 'kept', 'failed', 'refused')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.forwarding_checks": {
+ "name": "forwarding_checks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "phone_number_id": {
+ "name": "phone_number_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "business_number": {
+ "name": "business_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "linedesk_number": {
+ "name": "linedesk_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "caller_number": {
+ "name": "caller_number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "simulated": {
+ "name": "simulated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'dialing'"
+ },
+ "detail": {
+ "name": "detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "dialed_at": {
+ "name": "dialed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "arrived_at": {
+ "name": "arrived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "forwarding_checks_ws": {
+ "name": "forwarding_checks_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "forwarding_checks_arrival": {
+ "name": "forwarding_checks_arrival",
+ "columns": [
+ {
+ "expression": "caller_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "dialed_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "forwarding_checks_business": {
+ "name": "forwarding_checks_business",
+ "columns": [
+ {
+ "expression": "business_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.golive_checklist_dismissals": {
+ "name": "golive_checklist_dismissals",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dismissed_at": {
+ "name": "dismissed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "golive_checklist_dismissals_workspace_id_user_id_pk": {
+ "name": "golive_checklist_dismissals_workspace_id_user_id_pk",
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.golive_checklist_steps": {
+ "name": "golive_checklist_steps",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step": {
+ "name": "step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "until": {
+ "name": "until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "by_user_id": {
+ "name": "by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "golive_checklist_steps_workspace": {
+ "name": "golive_checklist_steps_workspace",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "step",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"golive_checklist_steps\".\"user_id\" is null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "golive_checklist_steps_person": {
+ "name": "golive_checklist_steps_person",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "step",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "state",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"golive_checklist_steps\".\"user_id\" is not null",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.instance_settings": {
+ "name": "instance_settings",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration_subscriptions": {
+ "name": "integration_subscriptions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "api_key_id": {
+ "name": "api_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_url": {
+ "name": "target_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "disabled_reason": {
+ "name": "disabled_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_count": {
+ "name": "failure_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_delivery_at": {
+ "name": "last_delivery_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_subscriptions_ws": {
+ "name": "integration_subscriptions_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_subscriptions_api_key_id_api_keys_id_fk": {
+ "name": "integration_subscriptions_api_key_id_api_keys_id_fk",
+ "tableFrom": "integration_subscriptions",
+ "tableTo": "api_keys",
+ "columnsFrom": [
+ "api_key_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.knowledge_questions": {
+ "name": "knowledge_questions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assistant_id": {
+ "name": "assistant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "question": {
+ "name": "question",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'open'"
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "knowledge_questions_ws": {
+ "name": "knowledge_questions_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "knowledge_questions_assistant": {
+ "name": "knowledge_questions_assistant",
+ "columns": [
+ {
+ "expression": "assistant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "knowledge_questions_assistant_id_assistants_id_fk": {
+ "name": "knowledge_questions_assistant_id_assistants_id_fk",
+ "tableFrom": "knowledge_questions",
+ "tableTo": "assistants",
+ "columnsFrom": [
+ "assistant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "knowledge_questions_call_id_calls_id_fk": {
+ "name": "knowledge_questions_call_id_calls_id_fk",
+ "tableFrom": "knowledge_questions",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ledger_entries": {
+ "name": "ledger_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "period_id": {
+ "name": "period_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "amount_micros": {
+ "name": "amount_micros",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "seconds": {
+ "name": "seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "included_seconds": {
+ "name": "included_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billable_seconds": {
+ "name": "billable_seconds",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cost_micros": {
+ "name": "cost_micros",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "price_basis": {
+ "name": "price_basis",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rate_card_version": {
+ "name": "rate_card_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_type": {
+ "name": "source_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reverses_entry_id": {
+ "name": "reverses_entry_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "ledger_entries_bill_created": {
+ "name": "ledger_entries_bill_created",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ledger_entries_workspace_period": {
+ "name": "ledger_entries_workspace_period",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "period_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ledger_entries_billing_account_id_billing_accounts_id_fk": {
+ "name": "ledger_entries_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_period_id_billing_periods_id_fk": {
+ "name": "ledger_entries_period_id_billing_periods_id_fk",
+ "tableFrom": "ledger_entries",
+ "tableTo": "billing_periods",
+ "columnsFrom": [
+ "period_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "ledger_entries_reverses_same_bill": {
+ "name": "ledger_entries_reverses_same_bill",
+ "tableFrom": "ledger_entries",
+ "tableTo": "ledger_entries",
+ "columnsFrom": [
+ "reverses_entry_id",
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id",
+ "billing_account_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "ledger_entries_source": {
+ "name": "ledger_entries_source",
+ "nullsNotDistinct": false,
+ "columns": [
+ "source_type",
+ "source_id",
+ "kind"
+ ]
+ },
+ "ledger_entries_bill_entry": {
+ "name": "ledger_entries_bill_entry",
+ "nullsNotDistinct": false,
+ "columns": [
+ "id",
+ "billing_account_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "ledger_entries_kind": {
+ "name": "ledger_entries_kind",
+ "value": "\"ledger_entries\".\"kind\" in ('usage', 'number', 'recharge', 'topup', 'refund', 'credit', 'adjustment', 'writeoff')"
+ },
+ "ledger_entries_source_type": {
+ "name": "ledger_entries_source_type",
+ "value": "\"ledger_entries\".\"source_type\" in ('call', 'phone_number', 'billing_recharge', 'stripe_checkout', 'stripe_refund', 'admin', 'job')"
+ },
+ "ledger_entries_price_basis": {
+ "name": "ledger_entries_price_basis",
+ "value": "\"ledger_entries\".\"price_basis\" is null or \"ledger_entries\".\"price_basis\" in ('standard', 'premium', 'ultra', 'own_keys', 'fixed_5c', 'cost_plus_10')"
+ },
+ "ledger_entries_kind_source": {
+ "name": "ledger_entries_kind_source",
+ "value": "(\"ledger_entries\".\"kind\" = 'usage' and \"ledger_entries\".\"source_type\" = 'call') or (\"ledger_entries\".\"kind\" = 'number' and \"ledger_entries\".\"source_type\" = 'phone_number') or (\"ledger_entries\".\"kind\" = 'recharge' and \"ledger_entries\".\"source_type\" = 'billing_recharge') or (\"ledger_entries\".\"kind\" = 'topup' and \"ledger_entries\".\"source_type\" = 'stripe_checkout') or (\"ledger_entries\".\"kind\" = 'refund' and \"ledger_entries\".\"source_type\" = 'stripe_refund') or (\"ledger_entries\".\"kind\" in ('credit', 'adjustment', 'writeoff') and \"ledger_entries\".\"source_type\" in ('admin', 'job'))"
+ },
+ "ledger_entries_number_per_period": {
+ "name": "ledger_entries_number_per_period",
+ "value": "\"ledger_entries\".\"kind\" <> 'number' or right(\"ledger_entries\".\"source_id\", length(\"ledger_entries\".\"period_id\") + 1) = ':' || \"ledger_entries\".\"period_id\""
+ },
+ "ledger_entries_reverses_adjustment": {
+ "name": "ledger_entries_reverses_adjustment",
+ "value": "\"ledger_entries\".\"reverses_entry_id\" is null or \"ledger_entries\".\"kind\" = 'adjustment'"
+ },
+ "ledger_entries_usage_seconds": {
+ "name": "ledger_entries_usage_seconds",
+ "value": "\"ledger_entries\".\"kind\" <> 'usage' or (\"ledger_entries\".\"seconds\" is not null and \"ledger_entries\".\"included_seconds\" is not null and \"ledger_entries\".\"billable_seconds\" is not null and \"ledger_entries\".\"included_seconds\" >= 0 and \"ledger_entries\".\"billable_seconds\" >= 0 and \"ledger_entries\".\"seconds\" = \"ledger_entries\".\"included_seconds\" + \"ledger_entries\".\"billable_seconds\")"
+ },
+ "ledger_entries_seconds_usage_only": {
+ "name": "ledger_entries_seconds_usage_only",
+ "value": "\"ledger_entries\".\"kind\" = 'usage' or (\"ledger_entries\".\"seconds\" is null and \"ledger_entries\".\"included_seconds\" is null and \"ledger_entries\".\"billable_seconds\" is null)"
+ },
+ "ledger_entries_sign": {
+ "name": "ledger_entries_sign",
+ "value": "(\"ledger_entries\".\"kind\" in ('usage', 'number', 'refund') and \"ledger_entries\".\"amount_micros\" <= 0) or (\"ledger_entries\".\"kind\" in ('recharge', 'topup', 'credit', 'writeoff') and \"ledger_entries\".\"amount_micros\" >= 0) or \"ledger_entries\".\"kind\" = 'adjustment'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.line_lookups": {
+ "name": "line_lookups",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "number": {
+ "name": "number",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "looked_up_at": {
+ "name": "looked_up_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "line_lookups_ws": {
+ "name": "line_lookups_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "looked_up_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "line_lookups_at": {
+ "name": "line_lookups_at",
+ "columns": [
+ {
+ "expression": "looked_up_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mail_analyses": {
+ "name": "mail_analyses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'queued'"
+ },
+ "months": {
+ "name": "months",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "conversations_read": {
+ "name": "conversations_read",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "conversations_analyzed": {
+ "name": "conversations_analyzed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "conversations_covered": {
+ "name": "conversations_covered",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "topics": {
+ "name": "topics",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "progress": {
+ "name": "progress",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by": {
+ "name": "requested_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "mail_analyses_ws_created": {
+ "name": "mail_analyses_ws_created",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mail_connections": {
+ "name": "mail_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_email": {
+ "name": "account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connected'"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_by": {
+ "name": "connected_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "mail_connections_ws": {
+ "name": "mail_connections_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "mail_connections_account": {
+ "name": "mail_connections_account",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "provider",
+ "account_email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mail_credentials": {
+ "name": "mail_credentials",
+ "schema": "",
+ "columns": {
+ "connection_id": {
+ "name": "connection_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "mail_credentials_connection_id_mail_connections_id_fk": {
+ "name": "mail_credentials_connection_id_mail_connections_id_fk",
+ "tableFrom": "mail_credentials",
+ "tableTo": "mail_connections",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.mail_oauth_states": {
+ "name": "mail_oauth_states",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code_verifier": {
+ "name": "code_verifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member_notification_settings": {
+ "name": "member_notification_settings",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "browser": {
+ "name": "browser",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "push_summary": {
+ "name": "push_summary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assigned_email": {
+ "name": "assigned_email",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "setup_emails": {
+ "name": "setup_emails",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "member_notification_settings_workspace_id_user_id_pk": {
+ "name": "member_notification_settings_workspace_id_user_id_pk",
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.number_purchases": {
+ "name": "number_purchases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_id": {
+ "name": "actor_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "e164": {
+ "name": "e164",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "carrier_account": {
+ "name": "carrier_account",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "by_admin": {
+ "name": "by_admin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "number_purchases_ws": {
+ "name": "number_purchases_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "number_purchases_created": {
+ "name": "number_purchases_created",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_clients": {
+ "name": "oauth_clients",
+ "schema": "",
+ "columns": {
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_method": {
+ "name": "auth_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_hash": {
+ "name": "secret_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_codes": {
+ "name": "oauth_codes",
+ "schema": "",
+ "columns": {
+ "code_hash": {
+ "name": "code_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_name": {
+ "name": "client_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redirect_uri": {
+ "name": "redirect_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code_challenge": {
+ "name": "code_challenge",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource": {
+ "name": "resource",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "personal_key_id": {
+ "name": "personal_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "used_at": {
+ "name": "used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauth_codes_expires": {
+ "name": "oauth_codes_expires",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_codes_user_id_user_id_fk": {
+ "name": "oauth_codes_user_id_user_id_fk",
+ "tableFrom": "oauth_codes",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.partner_branding": {
+ "name": "partner_branding",
+ "schema": "",
+ "columns": {
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "logo_version": {
+ "name": "logo_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "support_email": {
+ "name": "support_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "terms_url": {
+ "name": "terms_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "privacy_url": {
+ "name": "privacy_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revision": {
+ "name": "revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_revision": {
+ "name": "approved_revision",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_name": {
+ "name": "approved_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_logo": {
+ "name": "approved_logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_logo_version": {
+ "name": "approved_logo_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_support_email": {
+ "name": "approved_support_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_terms_url": {
+ "name": "approved_terms_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_privacy_url": {
+ "name": "approved_privacy_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "support_email_verified": {
+ "name": "support_email_verified",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_by": {
+ "name": "approved_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "partner_branding_partner_id_partners_id_fk": {
+ "name": "partner_branding_partner_id_partners_id_fk",
+ "tableFrom": "partner_branding",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "partner_branding_color": {
+ "name": "partner_branding_color",
+ "value": "\"partner_branding\".\"color\" is null or \"partner_branding\".\"color\" ~ '^#[0-9a-f]{6}$'"
+ },
+ "partner_branding_approved": {
+ "name": "partner_branding_approved",
+ "value": "(\"partner_branding\".\"approved_revision\" is null) = (\"partner_branding\".\"approved_name\" is null) and (\"partner_branding\".\"approved_revision\" is null) = (\"partner_branding\".\"approved_at\" is null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.partner_domains": {
+ "name": "partner_domains",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hostname": {
+ "name": "hostname",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "challenge_token": {
+ "name": "challenge_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_records": {
+ "name": "provider_records",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_status": {
+ "name": "provider_status",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_checked_at": {
+ "name": "last_checked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checks_until": {
+ "name": "checks_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_at": {
+ "name": "active_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure": {
+ "name": "failure",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "removed_at": {
+ "name": "removed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "removed_by": {
+ "name": "removed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "removed_reason": {
+ "name": "removed_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "partner_domains_hostname": {
+ "name": "partner_domains_hostname",
+ "columns": [
+ {
+ "expression": "hostname",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"partner_domains\".\"status\" <> 'removed'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "partner_domains_one_per_partner": {
+ "name": "partner_domains_one_per_partner",
+ "columns": [
+ {
+ "expression": "partner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"partner_domains\".\"status\" <> 'removed'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "partner_domains_partner_id_partners_id_fk": {
+ "name": "partner_domains_partner_id_partners_id_fk",
+ "tableFrom": "partner_domains",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "partner_domains_status": {
+ "name": "partner_domains_status",
+ "value": "\"partner_domains\".\"status\" in ('pending', 'verifying', 'active', 'failed', 'stopped', 'removed')"
+ },
+ "partner_domains_failure": {
+ "name": "partner_domains_failure",
+ "value": "\"partner_domains\".\"failure\" is null or \"partner_domains\".\"failure\" in ('cname_missing', 'txt_missing', 'cert_failed', 'moved', 'probe_failed')"
+ },
+ "partner_domains_hostname": {
+ "name": "partner_domains_hostname",
+ "value": "\"partner_domains\".\"hostname\" ~ '^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$'"
+ },
+ "partner_domains_removed": {
+ "name": "partner_domains_removed",
+ "value": "(\"partner_domains\".\"status\" = 'removed') = (\"partner_domains\".\"removed_at\" is not null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.partner_invitations": {
+ "name": "partner_invitations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "invited_by": {
+ "name": "invited_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canceled_at": {
+ "name": "canceled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "partner_invitations_token": {
+ "name": "partner_invitations_token",
+ "columns": [
+ {
+ "expression": "token_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "partner_invitations_partner": {
+ "name": "partner_invitations_partner",
+ "columns": [
+ {
+ "expression": "partner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "partner_invitations_email": {
+ "name": "partner_invitations_email",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "partner_invitations_partner_id_partners_id_fk": {
+ "name": "partner_invitations_partner_id_partners_id_fk",
+ "tableFrom": "partner_invitations",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "partner_invitations_role": {
+ "name": "partner_invitations_role",
+ "value": "\"partner_invitations\".\"role\" in ('owner', 'admin')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.partner_members": {
+ "name": "partner_members",
+ "schema": "",
+ "columns": {
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "partner_members_user": {
+ "name": "partner_members_user",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "partner_members_one_owner": {
+ "name": "partner_members_one_owner",
+ "columns": [
+ {
+ "expression": "partner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"partner_members\".\"role\" = 'owner'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "partner_members_partner_id_partners_id_fk": {
+ "name": "partner_members_partner_id_partners_id_fk",
+ "tableFrom": "partner_members",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "partner_members_user_id_user_id_fk": {
+ "name": "partner_members_user_id_user_id_fk",
+ "tableFrom": "partner_members",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "partner_members_partner_id_user_id_pk": {
+ "name": "partner_members_partner_id_user_id_pk",
+ "columns": [
+ "partner_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "partner_members_role": {
+ "name": "partner_members_role",
+ "value": "\"partner_members\".\"role\" in ('owner', 'admin')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.partner_providers": {
+ "name": "partner_providers",
+ "schema": "",
+ "columns": {
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "category": {
+ "name": "category",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_encrypted": {
+ "name": "key_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last4": {
+ "name": "last4",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'untested'"
+ },
+ "failure": {
+ "name": "failure",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checked_at": {
+ "name": "checked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_emailed_at": {
+ "name": "failure_emailed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "partner_providers_partner_id_partners_id_fk": {
+ "name": "partner_providers_partner_id_partners_id_fk",
+ "tableFrom": "partner_providers",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "partner_providers_partner_id_category_pk": {
+ "name": "partner_providers_partner_id_category_pk",
+ "columns": [
+ "partner_id",
+ "category"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "partner_providers_category": {
+ "name": "partner_providers_category",
+ "value": "\"partner_providers\".\"category\" in ('stt', 'llm', 'tts', 'realtime')"
+ },
+ "partner_providers_status": {
+ "name": "partner_providers_status",
+ "value": "\"partner_providers\".\"status\" in ('untested', 'ok', 'failing')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.partner_sender_domains": {
+ "name": "partner_sender_domains",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "local_part": {
+ "name": "local_part",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'notify'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'resend'"
+ },
+ "provider_domain_id": {
+ "name": "provider_domain_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "records": {
+ "name": "records",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "provider_status": {
+ "name": "provider_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_checks": {
+ "name": "failed_checks",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_checked_at": {
+ "name": "last_checked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checks_until": {
+ "name": "checks_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verified_at": {
+ "name": "verified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_at": {
+ "name": "failed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "removed_at": {
+ "name": "removed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "removed_by": {
+ "name": "removed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "removed_reason": {
+ "name": "removed_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "partner_sender_domains_domain": {
+ "name": "partner_sender_domains_domain",
+ "columns": [
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"partner_sender_domains\".\"status\" <> 'removed'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "partner_sender_domains_one_per_partner": {
+ "name": "partner_sender_domains_one_per_partner",
+ "columns": [
+ {
+ "expression": "partner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"partner_sender_domains\".\"status\" <> 'removed'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "partner_sender_domains_partner_id_partners_id_fk": {
+ "name": "partner_sender_domains_partner_id_partners_id_fk",
+ "tableFrom": "partner_sender_domains",
+ "tableTo": "partners",
+ "columnsFrom": [
+ "partner_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "partner_sender_domains_status": {
+ "name": "partner_sender_domains_status",
+ "value": "\"partner_sender_domains\".\"status\" in ('pending', 'verified', 'failed', 'stopped', 'removed')"
+ },
+ "partner_sender_domains_domain": {
+ "name": "partner_sender_domains_domain",
+ "value": "\"partner_sender_domains\".\"domain\" ~ '^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$'"
+ },
+ "partner_sender_domains_local_part": {
+ "name": "partner_sender_domains_local_part",
+ "value": "\"partner_sender_domains\".\"local_part\" ~ '^[a-z0-9][a-z0-9._-]{0,31}$'"
+ },
+ "partner_sender_domains_removed": {
+ "name": "partner_sender_domains_removed",
+ "value": "(\"partner_sender_domains\".\"status\" = 'removed') = (\"partner_sender_domains\".\"removed_at\" is not null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.partners": {
+ "name": "partners",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_by": {
+ "name": "approved_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "suspended_at": {
+ "name": "suspended_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "setup_step": {
+ "name": "setup_step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "own_keys_disabled_reason": {
+ "name": "own_keys_disabled_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "own_keys_disabled_at": {
+ "name": "own_keys_disabled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "partners_billing_account_id_billing_accounts_id_fk": {
+ "name": "partners_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "partners",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "partners_billing_account_id_unique": {
+ "name": "partners_billing_account_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "billing_account_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "partners_status": {
+ "name": "partners_status",
+ "value": "\"partners\".\"status\" in ('pending', 'approved', 'suspended')"
+ },
+ "partners_suspended": {
+ "name": "partners_suspended",
+ "value": "(\"partners\".\"status\" = 'suspended') = (\"partners\".\"suspended_at\" is not null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.personal_keys": {
+ "name": "personal_keys",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_hash": {
+ "name": "key_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "passkey_confirmed": {
+ "name": "passkey_confirmed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "oauth_client_id": {
+ "name": "oauth_client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_used_at": {
+ "name": "last_used_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "revoked_at": {
+ "name": "revoked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "personal_keys_user": {
+ "name": "personal_keys_user",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "personal_keys_user_id_user_id_fk": {
+ "name": "personal_keys_user_id_user_id_fk",
+ "tableFrom": "personal_keys",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "personal_keys_key_hash_unique": {
+ "name": "personal_keys_key_hash_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "key_hash"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.phone_numbers": {
+ "name": "phone_numbers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "e164": {
+ "name": "e164",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "mode": {
+ "name": "mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'forward_conditional'"
+ },
+ "forwarded_from": {
+ "name": "forwarded_from",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_ref": {
+ "name": "provider_ref",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "carrier_account": {
+ "name": "carrier_account",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'install'"
+ },
+ "purchased": {
+ "name": "purchased",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "assistant_id": {
+ "name": "assistant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "verified_at": {
+ "name": "verified_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "phone_numbers_ws": {
+ "name": "phone_numbers_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "phone_numbers_e164_unique": {
+ "name": "phone_numbers_e164_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "e164"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.profile_changes": {
+ "name": "profile_changes",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "changed_by": {
+ "name": "changed_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "changed_at": {
+ "name": "changed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "previous": {
+ "name": "previous",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "profile_changes_user_id_user_id_fk": {
+ "name": "profile_changes_user_id_user_id_fk",
+ "tableFrom": "profile_changes",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.prompt_overrides": {
+ "name": "prompt_overrides",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "default_text": {
+ "name": "default_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.provider_failures": {
+ "name": "provider_failures",
+ "schema": "",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "since": {
+ "name": "since",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_at": {
+ "name": "last_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "alerted_at": {
+ "name": "alerted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.provider_settings": {
+ "name": "provider_settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field": {
+ "name": "field",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_encrypted": {
+ "name": "value_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last4": {
+ "name": "last4",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "provider_settings_slot": {
+ "name": "provider_settings_slot",
+ "nullsNotDistinct": true,
+ "columns": [
+ "workspace_id",
+ "provider",
+ "field"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.provider_tests": {
+ "name": "provider_tests",
+ "schema": "",
+ "columns": {
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "keys": {
+ "name": "keys",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ok": {
+ "name": "ok",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tested_at": {
+ "name": "tested_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.push_subscriptions": {
+ "name": "push_subscriptions",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint": {
+ "name": "endpoint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "p256dh": {
+ "name": "p256dh",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth": {
+ "name": "auth",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "push_subscriptions_user_idx": {
+ "name": "push_subscriptions_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "push_subscriptions_workspace_id_endpoint_pk": {
+ "name": "push_subscriptions_workspace_id_endpoint_pk",
+ "columns": [
+ "workspace_id",
+ "endpoint"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.reply_timings": {
+ "name": "reply_timings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "at": {
+ "name": "at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pipeline": {
+ "name": "pipeline",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "providers": {
+ "name": "providers",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "turn_ms": {
+ "name": "turn_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model_ms": {
+ "name": "model_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "voice_ms": {
+ "name": "voice_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "server_ms": {
+ "name": "server_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_ms": {
+ "name": "total_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "heard_ms": {
+ "name": "heard_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "reply_timings_at": {
+ "name": "reply_timings_at",
+ "columns": [
+ {
+ "expression": "at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "reply_timings_call_id_calls_id_fk": {
+ "name": "reply_timings_call_id_calls_id_fk",
+ "tableFrom": "reply_timings",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.setup_emails": {
+ "name": "setup_emails",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "setup_emails_workspace_id_kind_pk": {
+ "name": "setup_emails_workspace_id_kind_pk",
+ "columns": [
+ "workspace_id",
+ "kind"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.setup_events": {
+ "name": "setup_events",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "at": {
+ "name": "at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "setup_events_signup_at": {
+ "name": "setup_events_signup_at",
+ "columns": [
+ {
+ "expression": "at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "event = 'signup'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "setup_events_workspace_id_event_pk": {
+ "name": "setup_events_workspace_id_event_pk",
+ "columns": [
+ "workspace_id",
+ "event"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.shopify_installs": {
+ "name": "shopify_installs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "shop": {
+ "name": "shop",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "shop_name": {
+ "name": "shop_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_encrypted": {
+ "name": "access_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_encrypted": {
+ "name": "refresh_token_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "installed_at": {
+ "name": "installed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "exchanged_at": {
+ "name": "exchanged_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uninstalled_at": {
+ "name": "uninstalled_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "shopify_installs_ws": {
+ "name": "shopify_installs_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "shopify_installs_workspace_id_organization_id_fk": {
+ "name": "shopify_installs_workspace_id_organization_id_fk",
+ "tableFrom": "shopify_installs",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "shopify_installs_shop_unique": {
+ "name": "shopify_installs_shop_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "shop"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.shopify_link_tokens": {
+ "name": "shopify_link_tokens",
+ "schema": "",
+ "columns": {
+ "token_hash": {
+ "name": "token_hash",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "shop": {
+ "name": "shop",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_by": {
+ "name": "started_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "shopify_link_tokens_shop": {
+ "name": "shopify_link_tokens_shop",
+ "columns": [
+ {
+ "expression": "shop",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "shopify_link_tokens_shop_shopify_installs_shop_fk": {
+ "name": "shopify_link_tokens_shop_shopify_installs_shop_fk",
+ "tableFrom": "shopify_link_tokens",
+ "tableTo": "shopify_installs",
+ "columnsFrom": [
+ "shop"
+ ],
+ "columnsTo": [
+ "shop"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sign_in_counters": {
+ "name": "sign_in_counters",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "hour": {
+ "name": "hour",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "sign_in_counters_user_id_user_id_fk": {
+ "name": "sign_in_counters_user_id_user_id_fk",
+ "tableFrom": "sign_in_counters",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "sign_in_counters_user_id_kind_hour_pk": {
+ "name": "sign_in_counters_user_id_kind_hour_pk",
+ "columns": [
+ "user_id",
+ "kind",
+ "hour"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.signup_attempts": {
+ "name": "signup_attempts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_hash": {
+ "name": "email_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ip_bucket": {
+ "name": "ip_bucket",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "signup_attempts_email": {
+ "name": "signup_attempts_email",
+ "columns": [
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email_hash",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "signup_attempts_ip": {
+ "name": "signup_attempts_ip",
+ "columns": [
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "ip_bucket",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "signup_attempts_created": {
+ "name": "signup_attempts_created",
+ "columns": [
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "signup_attempts_kind": {
+ "name": "signup_attempts_kind",
+ "value": "\"signup_attempts\".\"kind\" in ('code', 'signup')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.spending_cap_alerts": {
+ "name": "spending_cap_alerts",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "month": {
+ "name": "month",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "level": {
+ "name": "level",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "spending_cap_alerts_workspace_id_month_level_pk": {
+ "name": "spending_cap_alerts_workspace_id_month_level_pk",
+ "columns": [
+ "workspace_id",
+ "month",
+ "level"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.star_prompts": {
+ "name": "star_prompts",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "answer": {
+ "name": "answer",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "answered_at": {
+ "name": "answered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.stripe_events": {
+ "name": "stripe_events",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "livemode": {
+ "name": "livemode",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created": {
+ "name": "created",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "received_at": {
+ "name": "received_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "processed_at": {
+ "name": "processed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "stripe_events_received": {
+ "name": "stripe_events_received",
+ "columns": [
+ {
+ "expression": "received_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.terms_acceptances": {
+ "name": "terms_acceptances",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "terms_url": {
+ "name": "terms_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "terms_version": {
+ "name": "terms_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "privacy_url": {
+ "name": "privacy_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "privacy_version": {
+ "name": "privacy_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disclosure": {
+ "name": "disclosure",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "terms_acceptances_user": {
+ "name": "terms_acceptances_user",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "accepted_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "terms_acceptances_bill": {
+ "name": "terms_acceptances_bill",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "terms_acceptances_source": {
+ "name": "terms_acceptances_source",
+ "value": "\"terms_acceptances\".\"source\" in ('signup', 'activation', 'trial_recharge', 'extra_calls', 'auto_recharge', 'terms_update')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.transcript_segments": {
+ "name": "transcript_segments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "call_id": {
+ "name": "call_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "speaker": {
+ "name": "speaker",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "text": {
+ "name": "text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "at_ms": {
+ "name": "at_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_event": {
+ "name": "tool_event",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "segments_call": {
+ "name": "segments_call",
+ "columns": [
+ {
+ "expression": "call_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "at_ms",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "transcript_segments_call_id_calls_id_fk": {
+ "name": "transcript_segments_call_id_calls_id_fk",
+ "tableFrom": "transcript_segments",
+ "tableTo": "calls",
+ "columnsFrom": [
+ "call_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.usage_counters": {
+ "name": "usage_counters",
+ "schema": "",
+ "columns": {
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_id": {
+ "name": "period_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "included_seconds_used": {
+ "name": "included_seconds_used",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "usage_micros": {
+ "name": "usage_micros",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "usage_counters_billing_account_id_billing_accounts_id_fk": {
+ "name": "usage_counters_billing_account_id_billing_accounts_id_fk",
+ "tableFrom": "usage_counters",
+ "tableTo": "billing_accounts",
+ "columnsFrom": [
+ "billing_account_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "usage_counters_period_id_billing_periods_id_fk": {
+ "name": "usage_counters_period_id_billing_periods_id_fk",
+ "tableFrom": "usage_counters",
+ "tableTo": "billing_periods",
+ "columnsFrom": [
+ "period_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "usage_counters_billing_account_id_period_id_workspace_id_pk": {
+ "name": "usage_counters_billing_account_id_period_id_workspace_id_pk",
+ "columns": [
+ "billing_account_id",
+ "period_id",
+ "workspace_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "usage_counters_included": {
+ "name": "usage_counters_included",
+ "value": "\"usage_counters\".\"included_seconds_used\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.usage_limit_alerts": {
+ "name": "usage_limit_alerts",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "period_id": {
+ "name": "period_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "level": {
+ "name": "level",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "usage_limit_alerts_workspace_id_period_id_level_pk": {
+ "name": "usage_limit_alerts_workspace_id_period_id_level_pk",
+ "columns": [
+ "workspace_id",
+ "period_id",
+ "level"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_avatars": {
+ "name": "user_avatars",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "png": {
+ "name": "png",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_avatars_user_id_user_id_fk": {
+ "name": "user_avatars_user_id_user_id_fk",
+ "tableFrom": "user_avatars",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.voice_clones": {
+ "name": "voice_clones",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "voice_id": {
+ "name": "voice_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consent_by": {
+ "name": "consent_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consent_at": {
+ "name": "consent_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consent_text": {
+ "name": "consent_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "voice_clones_ws": {
+ "name": "voice_clones_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "voice_clones_voice": {
+ "name": "voice_clones_voice",
+ "nullsNotDistinct": false,
+ "columns": [
+ "provider",
+ "voice_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_deliveries": {
+ "name": "webhook_deliveries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subscription_id": {
+ "name": "subscription_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_attempt_at": {
+ "name": "last_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_deliveries_endpoint": {
+ "name": "webhook_deliveries_endpoint",
+ "columns": [
+ {
+ "expression": "endpoint_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_deliveries_endpoint_id_webhook_endpoints_id_fk": {
+ "name": "webhook_deliveries_endpoint_id_webhook_endpoints_id_fk",
+ "tableFrom": "webhook_deliveries",
+ "tableTo": "webhook_endpoints",
+ "columnsFrom": [
+ "endpoint_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "webhook_deliveries_subscription_id_integration_subscriptions_id_fk": {
+ "name": "webhook_deliveries_subscription_id_integration_subscriptions_id_fk",
+ "tableFrom": "webhook_deliveries",
+ "tableTo": "integration_subscriptions",
+ "columnsFrom": [
+ "subscription_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_endpoints": {
+ "name": "webhook_endpoints",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "assistant_id": {
+ "name": "assistant_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hooks": {
+ "name": "hooks",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "lookups": {
+ "name": "lookups",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "disabled_reason": {
+ "name": "disabled_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failure_count": {
+ "name": "failure_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "last_delivery_at": {
+ "name": "last_delivery_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "webhook_endpoints_ws": {
+ "name": "webhook_endpoints_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_endpoints_assistant": {
+ "name": "webhook_endpoints_assistant",
+ "columns": [
+ {
+ "expression": "assistant_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_endpoints_assistant_id_assistants_id_fk": {
+ "name": "webhook_endpoints_assistant_id_assistants_id_fk",
+ "tableFrom": "webhook_endpoints",
+ "tableTo": "assistants",
+ "columnsFrom": [
+ "assistant_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_secrets": {
+ "name": "webhook_secrets",
+ "schema": "",
+ "columns": {
+ "endpoint_id": {
+ "name": "endpoint_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret_encrypted": {
+ "name": "secret_encrypted",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "webhook_secrets_endpoint_id_webhook_endpoints_id_fk": {
+ "name": "webhook_secrets_endpoint_id_webhook_endpoints_id_fk",
+ "tableFrom": "webhook_secrets",
+ "tableTo": "webhook_endpoints",
+ "columnsFrom": [
+ "endpoint_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_icons": {
+ "name": "workspace_icons",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "png": {
+ "name": "png",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_members": {
+ "name": "workspace_members",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "avatar_version": {
+ "name": "avatar_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {
+ "workspace_members_ws": {
+ "name": "workspace_members_ws",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace_settings": {
+ "name": "workspace_settings",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "outbound_calls_enabled": {
+ "name": "outbound_calls_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "onboarding_step": {
+ "name": "onboarding_step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pickup_mode": {
+ "name": "pickup_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "business_kind": {
+ "name": "business_kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "recording_retention_days": {
+ "name": "recording_retention_days",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 90
+ },
+ "notify_email_default": {
+ "name": "notify_email_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notify_browser_default": {
+ "name": "notify_browser_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notify_assigned_default": {
+ "name": "notify_assigned_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "business_hours_on": {
+ "name": "business_hours_on",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "carrier": {
+ "name": "carrier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "partner_keys": {
+ "name": "partner_keys",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "client_call_quality": {
+ "name": "client_call_quality",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "closure": {
+ "name": "closure",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country_hint": {
+ "name": "country_hint",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country_hint_source": {
+ "name": "country_hint_source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timezone_follows_country": {
+ "name": "timezone_follows_country",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "holidays": {
+ "name": "holidays",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_value_cents": {
+ "name": "job_value_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "job_value_currency": {
+ "name": "job_value_currency",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'USD'"
+ },
+ "job_value_currency_follows_country": {
+ "name": "job_value_currency_follows_country",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "nextval('row_version')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_settings_country_hint": {
+ "name": "workspace_settings_country_hint",
+ "value": "\"workspace_settings\".\"country_hint\" ~ '^[A-Z]{2}$'"
+ },
+ "workspace_settings_country_hint_source": {
+ "name": "workspace_settings_country_hint_source",
+ "value": "\"workspace_settings\".\"country_hint_source\" in ('sign_up_location', 'time_zone', 'browser_language')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "join_on_sign_in": {
+ "name": "join_on_sign_in",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {
+ "invitation_organizationId_idx": {
+ "name": "invitation_organizationId_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_organization_id_organization_id_fk": {
+ "name": "invitation_organization_id_organization_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": [
+ "inviter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member": {
+ "name": "member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "member_organizationId_idx": {
+ "name": "member_organizationId_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_partner_idx": {
+ "name": "member_partner_idx",
+ "columns": [
+ {
+ "expression": "partner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_userId_idx": {
+ "name": "member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_organization_user_uidx": {
+ "name": "member_organization_user_uidx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_one_owner_uidx": {
+ "name": "member_one_owner_uidx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"member\".\"role\" = 'owner'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "member_organization_id_organization_id_fk": {
+ "name": "member_organization_id_organization_id_fk",
+ "tableFrom": "member",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_user_id_user_id_fk": {
+ "name": "member_user_id_user_id_fk",
+ "tableFrom": "member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "member_partner_admin": {
+ "name": "member_partner_admin",
+ "value": "\"member\".\"partner_id\" is null or \"member\".\"role\" = 'admin'"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.organization": {
+ "name": "organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled_at": {
+ "name": "disabled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spending_cap_cents": {
+ "name": "spending_cap_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_account_id": {
+ "name": "billing_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "billing_state": {
+ "name": "billing_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "extra_calls": {
+ "name": "extra_calls",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "partner_id": {
+ "name": "partner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "usage_limit_cents": {
+ "name": "usage_limit_cents",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "organization_slug_uidx": {
+ "name": "organization_slug_uidx",
+ "columns": [
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "organization_billing_account_idx": {
+ "name": "organization_billing_account_idx",
+ "columns": [
+ {
+ "expression": "billing_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "organization_partner_idx": {
+ "name": "organization_partner_idx",
+ "columns": [
+ {
+ "expression": "partner_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_slug_unique": {
+ "name": "organization_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "organization_billing_state": {
+ "name": "organization_billing_state",
+ "value": "\"organization\".\"billing_state\" is null or \"organization\".\"billing_state\" in ('pending_payment', 'active', 'suspended')"
+ },
+ "organization_extra_calls": {
+ "name": "organization_extra_calls",
+ "value": "\"organization\".\"extra_calls\" between 0 and 1000 and \"organization\".\"extra_calls\" % 5 = 0"
+ },
+ "organization_usage_limit": {
+ "name": "organization_usage_limit",
+ "value": "\"organization\".\"usage_limit_cents\" is null or \"organization\".\"usage_limit_cents\" between 100 and 10000000"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_type": {
+ "name": "device_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aaguid": {
+ "name": "aaguid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "passkey_userId_idx": {
+ "name": "passkey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "passkey_credentialID_uidx": {
+ "name": "passkey_credentialID_uidx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "passkey_user_id_user_id_fk": {
+ "name": "passkey_user_id_user_id_fk",
+ "tableFrom": "passkey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impersonated_by": {
+ "name": "impersonated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "impersonation_edits_at": {
+ "name": "impersonation_edits_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "passkey_verified_at": {
+ "name": "passkey_verified_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "second_factor_method": {
+ "name": "second_factor_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "host": {
+ "name": "host",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "host_domain_id": {
+ "name": "host_domain_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "session_impersonated_by_user_id_fk": {
+ "name": "session_impersonated_by_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "impersonated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "instance_admin": {
+ "name": "instance_admin",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "disabled_at": {
+ "name": "disabled_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_sign_in_at": {
+ "name": "last_sign_in_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "passkey_enrolment_hash": {
+ "name": "passkey_enrolment_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "passkey_enrolment_expires_at": {
+ "name": "passkey_enrolment_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "locale_auto": {
+ "name": "locale_auto",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {
+ "public.row_version": {
+ "name": "row_version",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "9223372036854775807",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.json
index 885301e9..ab773d05 100644
--- a/packages/db/migrations/meta/_journal.json
+++ b/packages/db/migrations/meta/_journal.json
@@ -1324,6 +1324,13 @@
"when": 1795680333053,
"tag": "0189_assigned_email_default",
"breakpoints": true
+ },
+ {
+ "idx": 189,
+ "version": "7",
+ "when": 1795884605681,
+ "tag": "0190_outbound_calls_enabled",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema.ts b/packages/db/src/schema.ts
index dbff6bae..8936735f 100644
--- a/packages/db/src/schema.ts
+++ b/packages/db/src/schema.ts
@@ -443,6 +443,11 @@ export const workspace_settings = pgTable(
* `activate`: a self-serve sign-up's last step before its trial starts.
* `hours`, `calendar` and `test_call` are steps of the earlier flow, still read (resumeStep maps them).
*/
+ /**
+ * Outbound AI calls (call.dial, call.guide, the Outbound calls page; LIN-873): off until a server admin turns them
+ * on for the workspace (workspace.setOutboundCalls). Self-serve sign-ups never get them by default.
+ */
+ outbound_calls_enabled: boolean('outbound_calls_enabled').notNull().default(false),
onboarding_step: text('onboarding_step', {
enum: [
'business',
diff --git a/packages/i18n/locales/en/server.json b/packages/i18n/locales/en/server.json
index 1feb9ab3..65834852 100644
--- a/packages/i18n/locales/en/server.json
+++ b/packages/i18n/locales/en/server.json
@@ -138,6 +138,8 @@
"api.confirmEmailForTransfer": "Confirm your email first: this version puts calls through to a number",
"api.dial.invalidNumber": "Enter the number to call in E.164, with its country code, like +4930123456.",
"api.dial.noNumber": "The workspace has no phone number to call from yet: connect one first.",
+ "api.dial.notDomestic": "Calls can only go to numbers in the same country as the number they come from.",
+ "api.dial.notEnabled": "Outbound calls are not turned on for this workspace yet. Ask the Linedesk team.",
"api.dial.ownNumber": "The assistant cannot call its own number.",
"api.dial.roomUsed": "This outbound call was registered already.",
"api.dial.tooMany": "Too many outbound calls at once: try again in a minute.",