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.
TypeScript ai-receptionistanswering-serviceappointment-bookinglivekitlocal-firstmcpopen-sourceself-hostedsiptelephonytypescriptvoice-agentvoice-ai
Sign-up stores the referrer and UTM source (PR 2086)
Janikbe0b9955c90a
diff --git a/apps/api/src/admin-routes.ts b/apps/api/src/admin-routes.tsindex a54ec455..989a8baf 100644--- a/apps/api/src/admin-routes.ts+++ b/apps/api/src/admin-routes.ts@@ -93,6 +93,7 @@ const listUsers = (tx: Tx) =>sql`select u.id, u.name, u.email, u.email_verified, u.instance_admin,(select a.version from user_avatars a where a.user_id = u.id) as avatar_version,+ u.signup_utm_source, u.signup_utm_medium, u.signup_utm_campaign, u.signup_referrer,${utc('u.created_at')} as created_at, ${utc('u.disabled_at')} as disabled_at,${utc('coalesce(u.last_sign_in_at, (select max(s.created_at) from session s where s.user_id = u.id))')} as last_sign_in_at,coalesce((select json_agg(json_build_object('id', o.id, 'name', o.name, 'role', m.role, 'member_id', m.id) order by o.name)diff --git a/apps/api/src/signup-attribution.ts b/apps/api/src/signup-attribution.tsnew file mode 100644index 00000000..f29cc56b--- /dev/null+++ b/apps/api/src/signup-attribution.ts@@ -0,0 +1,28 @@+// Where a sign-up came from (LIN-910): the first landing the browser kept (apps/web/src/attribution.ts) goes with+// account.signUp and is stored once on the user. Only the campaign's own words (utm_source, utm_medium, utm_campaign)+// and the referring site's host; the first one wins, a later sign-up (a second workspace) never replaces it.+import type { SignupAttribution } from '@linedesk/actions'+import { type Tx, user } from '@linedesk/db'+import { eq } from 'drizzle-orm'++type Held = Pick<+ typeof user.$inferSelect,+ 'id' | 'signupUtmSource' | 'signupUtmMedium' | 'signupUtmCampaign' | 'signupReferrer'+>++/** Stores the attribution on the user unless they have one already; nothing usable in it: nothing stored. */+export async function storeSignupAttribution(tx: Tx, me: Held, attribution: SignupAttribution | undefined) {+ if (!attribution) return+ const { utmSource, utmMedium, utmCampaign, referrer } = attribution+ if (!utmSource && !utmMedium && !utmCampaign && !referrer) return+ if (me.signupUtmSource || me.signupUtmMedium || me.signupUtmCampaign || me.signupReferrer) return+ await tx+ .update(user)+ .set({+ signupUtmSource: utmSource ?? null,+ signupUtmMedium: utmMedium ?? null,+ signupUtmCampaign: utmCampaign ?? null,+ signupReferrer: referrer ?? null,+ })+ .where(eq(user.id, me.id))+}diff --git a/apps/api/src/signup-handlers.ts b/apps/api/src/signup-handlers.tsindex c622f432..1319f01e 100644--- a/apps/api/src/signup-handlers.ts+++ b/apps/api/src/signup-handlers.ts@@ -1,7 +1,7 @@// The handlers of self-serve sign-up (account.signUp, signup.*) and the daily sign-up sweep.// Apart from self-serve.ts, which the sign-in gate imports, so that the gate does not pull in workspace creation and// deletion (and with them the handler registry) while it loads.-import type { AccountSignUpData, CountryHint } from '@linedesk/actions'+import type { AccountSignUpData, CountryHint, SignupAttribution } from '@linedesk/actions'import {billing_accounts,billing_balances,@@ -33,6 +33,7 @@ export { TERMS_CHANGED }import { queueBillingAlert } from './jobs.ts'import { addToWorkspace } from './memberships.ts'import { refusePartner } from './partner-refusals.ts'+import { storeSignupAttribution } from './signup-attribution.ts'import { emailHash, SIGNUP_CODE_WINDOW_MS, selfServeState, signupRules } from './self-serve.ts'import { insertWorkspace } from './workspace-creation-handlers.ts'import { deleteAccounts, deleteWorkspace } from './workspace-delete.ts'@@ -68,6 +69,8 @@ type SignUpInput = {plan: 'cloud' | 'partner'interval: 'year' | 'month'timeZone?: string+ /** Where the person came from (the browser's first landing); stored once on the user (signup-attribution.ts). */+ attribution?: SignupAttributionacceptedTerms: { termsVersion: string; privacyVersion: string }}@@ -132,6 +135,7 @@ const signUp: Handler = async (ctx, input: SignUpInput) => {input.acceptedTerms.privacyVersion !== terms.privacyVersion)throw Reject.t('server.api.signup.termsChanged', undefined, TERMS_CHANGED)+ await storeSignupAttribution(tx, me, input.attribution)if (input.plan === 'partner') return partnerSignUp(ctx, me, input, terms)const billId = crypto.randomUUID()// One free trial per account: decided now, so the activation step and Checkout sell thediff --git a/apps/api/test/admin.test.ts b/apps/api/test/admin.test.tsindex 807dee08..80b5baf8 100644--- a/apps/api/test/admin.test.ts+++ b/apps/api/test/admin.test.ts@@ -1166,12 +1166,37 @@ describe('users', () => {'name',// Name, device type and date only: never a credential id or key.'passkeys',+ // Where they came from at sign-up (LIN-910): campaign words and the referring site's host, null when none.+ 'signup_referrer',+ 'signup_utm_campaign',+ 'signup_utm_medium',+ 'signup_utm_source',// The terms accepted last (LIN-420): versions, source and time, never the IP address or browser.'terms','workspaces',])})+ test('the list carries where a user came from at sign-up (LIN-910)', async () => {+ await db+ .update(user)+ .set({+ signupUtmSource: 'hackernews',+ signupUtmMedium: 'social',+ signupUtmCampaign: 'show-hn',+ signupReferrer: 'news.ycombinator.com',+ })+ .where(eq(user.id, other.owner.userId))+ const { users } = (await request(operator, 'GET', '/v1/admin/users')).body+ expect(users.find((u: { id: string }) => u.id === other.owner.userId)).toMatchObject({+ signup_utm_source: 'hackernews',+ signup_utm_medium: 'social',+ signup_utm_campaign: 'show-hn',+ signup_referrer: 'news.ycombinator.com',+ })+ expect(users.find((u: { id: string }) => u.id === operator.userId)).toMatchObject({ signup_utm_source: null })+ })+test('a disabled user is signed out and cannot sign in until enabled again', async () => {const ws = await createWorkspace('Disabled User Workspace')expect((await request(ws.owner, 'GET', '/v1/me')).status).toBe(200)diff --git a/apps/api/test/self-serve.test.ts b/apps/api/test/self-serve.test.tsindex 503631da..f77a44a2 100644--- a/apps/api/test/self-serve.test.ts+++ b/apps/api/test/self-serve.test.ts@@ -31,6 +31,7 @@ import { WEB_ORIGIN } from '../src/auth.ts'import { db } from '../src/db.ts'import { emailSender } from '../src/email.ts'import { setJobQueue } from '../src/jobs.ts'+import { storeSignupAttribution } from '../src/signup-attribution.ts'import { setProviderKeys } from '../src/provider-settings.ts'import { runAction } from '../src/run-action.ts'import {@@ -425,6 +426,57 @@ describe("the sign-up code email's button, in any browser", () => {})describe('account.signUp', () => {+ test('stores where the person came from, once (LIN-910)', async () => {+ const { email, made } = await signUpThroughPage(address('source'), {+ ...DETAILS,+ attribution: {+ utmSource: ' Hackernews ',+ utmMedium: 'Social',+ utmCampaign: 'show-hn',+ referrer: 'News.YCombinator.com',+ },+ })+ expect(made.status).toBe(200)+ expect(await accountOf(email)).toMatchObject({+ signupUtmSource: 'hackernews',+ signupUtmMedium: 'social',+ signupUtmCampaign: 'show-hn',+ signupReferrer: 'news.ycombinator.com',+ })+ // The first one wins: the same person's later sign-up (or any other attribution) never replaces it.+ const [me] = await db.select().from(user).where(eq(user.email, email))+ await db.transaction(tx => storeSignupAttribution(tx, me!, { utmSource: 'reddit', referrer: 'reddit.com' }))+ expect(await accountOf(email)).toMatchObject({+ signupUtmSource: 'hackernews',+ signupReferrer: 'news.ycombinator.com',+ })+ })++ test('drops what is no good: an address instead of a host, nothing usable, and never refuses the sign-up', async () => {+ const { email, made } = await signUpThroughPage(address('badsource'), {+ ...DETAILS,+ attribution: { utmSource: ' ', utmMedium: 'x'.repeat(300), referrer: 'https://evil.example/path?q=1' },+ })+ expect(made.status).toBe(200)+ expect(await accountOf(email)).toMatchObject({+ signupUtmSource: null,+ signupUtmMedium: 'x'.repeat(100),+ signupUtmCampaign: null,+ signupReferrer: null,+ })+ })++ test('no attribution: nothing stored', async () => {+ const { email, made } = await signUpThroughPage(address('nosource'))+ expect(made.status).toBe(200)+ expect(await accountOf(email)).toMatchObject({+ signupUtmSource: null,+ signupUtmMedium: null,+ signupUtmCampaign: null,+ signupReferrer: null,+ })+ })+test('makes the bill and its one workspace, waiting for Checkout, with the person as owner', async () => {const { email, who, made } = await signUpThroughPage()expect(made).toMatchObject({ status: 200, body: { ok: true, data: { existing: false } } })diff --git a/apps/web/src/admin/UsersPage.test.tsx b/apps/web/src/admin/UsersPage.test.tsxindex 239de8e9..b3b4b597 100644--- a/apps/web/src/admin/UsersPage.test.tsx+++ b/apps/web/src/admin/UsersPage.test.tsx@@ -1,7 +1,7 @@// Server admin › Users › a user (UsersPage.tsx UserDetail): the terms they accepted last (A9, LIN-420), or none.import { renderToStaticMarkup } from 'react-dom/server'import { expect, test } from 'vitest'-import type { AdminUser } from './api.ts'+import { type AdminUser, signupSource } from './api.ts'import { UserDetail } from './UsersPage.tsx'const user: AdminUser = {@@ -46,3 +46,18 @@ test('none recorded (or an older API without the field)', () => {expect(detail({ ...user, terms: null })).toContain('None recorded')expect(detail(user)).toContain('None recorded')})++test('shows where the user came from at sign-up, or that none is recorded (LIN-910)', () => {+ const none = detail(user)+ expect(none).toContain('Not recorded')+ const came = detail({+ ...user,+ signup_utm_source: 'hackernews',+ signup_utm_medium: 'social',+ signup_utm_campaign: 'show-hn',+ signup_referrer: 'news.ycombinator.com',+ })+ for (const text of ['hackernews', 'social', 'show-hn', 'news.ycombinator.com']) expect(came).toContain(text)+ expect(signupSource({ signup_utm_source: null, signup_referrer: 'reddit.com' })).toBe('reddit.com')+ expect(signupSource({ signup_utm_source: 'x', signup_referrer: 'reddit.com' })).toBe('x')+})diff --git a/apps/web/src/admin/UsersPage.tsx b/apps/web/src/admin/UsersPage.tsxindex f8b5515e..6fc6e7a4 100644--- a/apps/web/src/admin/UsersPage.tsx+++ b/apps/web/src/admin/UsersPage.tsx@@ -9,7 +9,7 @@ import { Avatar, Badge } from '../ui/kit.tsx'import { AddUser } from './AddUser.tsx'import { DetailActions, RowActions, useActionRunner, userActions } from './actions.tsx'import { AdminList, type Column, type ListKeys } from './AdminList.tsx'-import { type AdminUser, type AdminWorkspace, filterUsers, USER_FILTERS, type UserFilter } from './api.ts'+import { type AdminUser, type AdminWorkspace, filterUsers, signupSource, USER_FILTERS, type UserFilter } from './api.ts'import { UserWorkspaces } from './Memberships.tsx'import type { Notify } from './notify.ts'import { day, when } from './parts.tsx'@@ -46,6 +46,12 @@ const userColumns = (t: Translate): Column<AdminUser>[] => [wide: true,render: u => <WorkspacesCell user={u} />,},+ {+ key: 'source',+ label: t('admin.users.column.source'),+ sort: u => signupSource(u),+ render: u => signupSource(u) ?? <span className="adm-muted">–</span>,+ },{key: 'signin',label: t('admin.users.column.lastSignIn'),@@ -130,7 +136,9 @@ export function UsersList({rowId={u => u.id}columns={columns}initialSort={{ key: 'name', dir: 'asc' }}- searchText={u => `${u.name} ${u.email} ${u.workspaces.map(w => w.name).join(' ')}`}+ searchText={u =>+ `${u.name} ${u.email} ${u.workspaces.map(w => w.name).join(' ')} ${u.signup_utm_source ?? ''} ${u.signup_utm_medium ?? ''} ${u.signup_utm_campaign ?? ''} ${u.signup_referrer ?? ''}`+ }searchLabel={t('admin.users.search')}label={t('admin.sections.users.label')}onOpen={u => onOpen(u.id)}@@ -174,6 +182,10 @@ export function UserDetail({ user: u, workspaces, currentUserId, notify, reload,</Fact><Fact label={t('admin.users.fact.lastSignIn')}>{when(u.last_sign_in_at)}</Fact><Fact label={t('admin.users.fact.created')}>{day(u.created_at)}</Fact>+ <Fact label={t('admin.users.fact.source')}>{u.signup_utm_source ?? t('admin.users.fact.sourceNone')}</Fact>+ {u.signup_utm_medium && <Fact label={t('admin.users.fact.medium')}>{u.signup_utm_medium}</Fact>}+ {u.signup_utm_campaign && <Fact label={t('admin.users.fact.campaign')}>{u.signup_utm_campaign}</Fact>}+ {u.signup_referrer && <Fact label={t('admin.users.fact.referrer')}>{u.signup_referrer}</Fact>}<Fact label={t('admin.users.fact.terms')}>{u.terms? t('admin.users.fact.termsAccepted', { version: u.terms.terms_version, when: when(u.terms.accepted_at) })diff --git a/apps/web/src/admin/api.ts b/apps/web/src/admin/api.tsindex bd9d2749..c472cdc0 100644--- a/apps/web/src/admin/api.ts+++ b/apps/web/src/admin/api.ts@@ -79,8 +79,17 @@ export type AdminUser = {* none is recorded (absent from an older API).*/terms?: { terms_version: string; privacy_version: string; source: string; accepted_at: string } | null+ /** Where they came from at sign-up (LIN-910): the first landing's campaign words and referring site's host; null: none recorded. */+ signup_utm_source?: string | null+ signup_utm_medium?: string | null+ signup_utm_campaign?: string | null+ signup_referrer?: string | null}+/** The channel a sign-up came from: its utm_source, else the referring site's host; null when none was recorded. */+export const signupSource = (u: Pick<AdminUser, 'signup_utm_source' | 'signup_referrer'>): string | null =>+ u.signup_utm_source || u.signup_referrer || null+/*** Server admin › Users filter. `admins`: the server admins (instance admins). `noWorkspace`: accounts without a membership (kept on a removal or delete, or older* self-signed-up ones), so the admin can decide about each; nothing is deleted on its own (A9).diff --git a/apps/web/src/attribution.test.ts b/apps/web/src/attribution.test.tsnew file mode 100644index 00000000..fdf57ffb--- /dev/null+++ b/apps/web/src/attribution.test.ts@@ -0,0 +1,78 @@+// Where a sign-up came from (attribution.ts, LIN-910): the first landing that says something is kept and sent.+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { captureAttribution, clearAttribution, landingAttribution, readAttribution } from './attribution.ts'++const where = (search: string, referrer = '') => ({ search, referrer, host: 'app.linedesk.ai' })++const memory = () => {+ const m = new Map<string, string>()+ return {+ getItem: (k: string) => m.get(k) ?? null,+ setItem: (k: string, v: string) => void m.set(k, v),+ removeItem: (k: string) => void m.delete(k),+ clear: () => m.clear(),+ }+}++beforeEach(() => {+ vi.stubGlobal('localStorage', memory())+ vi.stubGlobal('sessionStorage', memory())+})+afterEach(() => vi.unstubAllGlobals())++describe('landingAttribution', () => {+ it('reads the utm words, lower case', () => {+ expect(+ landingAttribution('?utm_source=HackerNews&utm_medium=Social&utm_campaign=show-hn', '', 'app.linedesk.ai'),+ ).toEqual({+ utmSource: 'hackernews',+ utmMedium: 'social',+ utmCampaign: 'show-hn',+ })+ })++ it('keeps the referrer as a host only, never a path or query', () => {+ expect(landingAttribution('', 'https://www.reddit.com/r/selfhosted/comments/x?y=1', 'app.linedesk.ai')).toEqual({+ referrer: 'reddit.com',+ })+ })++ it('ignores the app itself, a sign-in provider and a non-web referrer', () => {+ for (const ref of [+ 'https://app.linedesk.ai/signup',+ 'https://accounts.google.com/',+ 'android-app://com.x',+ 'nonsense',+ ])+ expect(landingAttribution('', ref, 'app.linedesk.ai')).toEqual({})+ })+})++describe('captureAttribution', () => {+ it('keeps the first landing that says something, and not a later one', () => {+ captureAttribution(1000, where('?utm_source=hn'))+ sessionStorage.clear()+ captureAttribution(2000, where('?utm_source=reddit'))+ expect(readAttribution(3000)).toEqual({ utmSource: 'hn' })+ })++ it('a direct visit keeps nothing, so a later campaign visit still counts', () => {+ captureAttribution(1000, where(''))+ expect(readAttribution(1500)).toBeUndefined()+ captureAttribution(2000, where('?utm_source=x'))+ expect(readAttribution(2500)).toEqual({ utmSource: 'x' })+ })++ it('the referrer counts only on the first load of a tab (a sign-in return is no landing)', () => {+ captureAttribution(1000, where(''))+ captureAttribution(2000, where('', 'https://news.ycombinator.com/'))+ expect(readAttribution(2500)).toBeUndefined()+ })++ it('is forgotten after 30 days and after the sign-up', () => {+ captureAttribution(1000, where('?utm_source=hn'))+ expect(readAttribution(1000 + 31 * 24 * 3_600_000)).toBeUndefined()+ clearAttribution()+ expect(readAttribution(1500)).toBeUndefined()+ })+})diff --git a/apps/web/src/attribution.ts b/apps/web/src/attribution.tsnew file mode 100644index 00000000..ae22d10a--- /dev/null+++ b/apps/web/src/attribution.ts@@ -0,0 +1,111 @@+// Where a sign-up came from (LIN-910): the first landing in this browser that says something (a utm_source, utm_medium+// or utm_campaign in the address, or a link from another site) is kept in local storage and goes with account.signUp+// (signup.ts), which stores it once on the user (apps/api/src/signup-attribution.ts). Only the campaign's own words and+// the referring site's host, never a path, a query or an address; kept for 30 days, removed once the sign-up is made.+// The website passes its visitor's campaign on to the sign-up links (linedesk.ai nav.js), so a visit that came through+// it still names its first source and not linedesk.ai.++const KEY = 'linedesk.attribution'+/** Set in a tab's session storage by its first load: later loads in the tab (a sign-in's return) say nothing by their referrer. */+const SEEN = 'linedesk.attribution.seen'+/** The sign-in providers' own pages: coming back from them says nothing about where the person came from. */+const SIGN_IN_HOSTS = new Set([+ 'accounts.google.com',+ 'login.microsoftonline.com',+ 'login.live.com',+ 'appleid.apple.com',+])+const KEPT_MS = 30 * 24 * 3_600_000+const MAX = 100++/** What the sign-up sends: absent fields were not on the first landing. */+export type Attribution = { utmSource?: string; utmMedium?: string; utmCampaign?: string; referrer?: string }++const word = (value: string | null | undefined): string | undefined => {+ const clean = (value ?? '')+ // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters out of a value from the address+ .replace(/[\u0000-\u001f\u007f]/g, ' ')+ .replace(/\s+/g, ' ')+ .trim()+ .toLowerCase()+ .slice(0, MAX)+ return clean || undefined+}++/** The host of a referrer address, not this app's own and never with a path; none: undefined. */+function referrerHost(referrer: string, ownHost: string): string | undefined {+ if (!referrer) return undefined+ try {+ const url = new URL(referrer)+ if (url.protocol !== 'https:' && url.protocol !== 'http:') return undefined+ const host = url.hostname.toLowerCase().replace(/^www\./, '')+ return host && host !== ownHost.toLowerCase().replace(/^www\./, '') && !SIGN_IN_HOSTS.has(host)+ ? host.slice(0, MAX)+ : undefined+ } catch {+ return undefined+ }+}++/** What this landing says about where it came from: the address's utm_* words, and the referring site's host. */+export function landingAttribution(search: string, referrer: string, ownHost: string): Attribution {+ const query = new URLSearchParams(search)+ const found: Attribution = {+ utmSource: word(query.get('utm_source')),+ utmMedium: word(query.get('utm_medium')),+ utmCampaign: word(query.get('utm_campaign')),+ referrer: referrerHost(referrer, ownHost),+ }+ return Object.fromEntries(Object.entries(found).filter(([, v]) => v !== undefined)) as Attribution+}++/**+ * Called when the app loads: keeps this landing when it says something and none is kept yet (the first one wins,+ * until it is 30 days old). A direct visit keeps nothing, so a later visit with a campaign still counts. The referrer+ * counts only on a tab's first load: a sign-in's return to the same tab is not a landing.+ */+export function captureAttribution(+ now = Date.now(),+ where = { search: window.location.search, referrer: document.referrer, host: window.location.hostname },+) {+ try {+ const firstLoad = sessionStorage.getItem(SEEN) === null+ sessionStorage.setItem(SEEN, '1')+ const landing = landingAttribution(where.search, firstLoad ? where.referrer : '', where.host)+ if (Object.keys(landing).length === 0) return+ if (readAttribution(now)) return+ localStorage.setItem(KEY, JSON.stringify({ ...landing, at: now }))+ } catch {+ // Storage blocked: the sign-up simply carries no source.+ }+}++/** The kept landing, if it is there and not older than 30 days. */+export function readAttribution(now = Date.now()): Attribution | undefined {+ try {+ const raw = localStorage.getItem(KEY)+ if (!raw) return undefined+ const kept = JSON.parse(raw) as Record<string, unknown>+ if (typeof kept.at !== 'number' || now - kept.at > KEPT_MS) return undefined+ const text = (v: unknown) => (typeof v === 'string' && v ? v.slice(0, MAX) : undefined)+ const found: Attribution = {+ utmSource: text(kept.utmSource),+ utmMedium: text(kept.utmMedium),+ utmCampaign: text(kept.utmCampaign),+ referrer: text(kept.referrer),+ }+ const entries = Object.entries(found).filter(([, v]) => v !== undefined)+ return entries.length ? (Object.fromEntries(entries) as Attribution) : undefined+ } catch {+ return undefined+ }+}++/** After the sign-up is made: the source is on the user, nothing stays in the browser. */+export function clearAttribution() {+ try {+ localStorage.removeItem(KEY)+ } catch {+ // Nothing to remove.+ }+}diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsxindex 8f253ce4..ce1f668f 100644--- a/apps/web/src/main.tsx+++ b/apps/web/src/main.tsx@@ -17,6 +17,7 @@ import '@fontsource/geist-mono/500.css'import './styles.css'import './app.css'import './mobile.css'+import { captureAttribution } from './attribution.ts'import { captureOpenRouterReturn } from './admin/openrouterAuth.ts'import { fetchAuthMethods } from './auth.ts'import { activate, initialLocale, languageFromAddress, LocaleRoot } from './i18n/index.tsx'@@ -44,6 +45,9 @@ installTooltips()void loadBrand()registerServiceWorker()+// Where this visit came from (utm_* in the address, the referring site), kept for the sign-up (attribution.ts).+captureAttribution()+// Back from "Connect with OpenRouter": keep its answer for Server admin › Providers and clear the address.const openRouterBack = captureOpenRouterReturn(window.location.search)if (openRouterBack) window.history.replaceState(null, '', `${window.location.pathname}${openRouterBack}`)diff --git a/apps/web/src/signup.test.ts b/apps/web/src/signup.test.tsindex 4b667b05..9d60767c 100644--- a/apps/web/src/signup.test.ts+++ b/apps/web/src/signup.test.ts@@ -48,6 +48,24 @@ describe('signUpBusiness', () => {expect(JSON.parse(init!.body as string).acceptedTerms).toEqual(INPUT.acceptedTerms)})+ it('sends the kept landing and removes it after the sign-up (LIN-910)', async () => {+ const store = new Map<string, string>()+ vi.stubGlobal('localStorage', {+ getItem: (k: string) => store.get(k) ?? null,+ setItem: (k: string, v: string) => void store.set(k, v),+ removeItem: (k: string) => void store.delete(k),+ })+ localStorage.setItem(+ 'linedesk.attribution',+ JSON.stringify({ utmSource: 'hn', referrer: 'news.ycombinator.com', at: Date.now() }),+ )+ answer(200, { ok: true, data: { workspace: { id: 'ws_1' }, partner: null } })+ await signUpBusiness(INPUT)+ const [, init] = vi.mocked(fetch).mock.calls[0]!+ expect(JSON.parse(init!.body as string).attribution).toEqual({ utmSource: 'hn', referrer: 'news.ycombinator.com' })+ expect(localStorage.getItem('linedesk.attribution')).toBeNull()+ })+it('a partner sign-up sends them too', async () => {answer(200, { ok: true, data: { workspace: null, partner: { id: 'ptn_1' } } })expect(await signUpBusiness({ ...INPUT, businessName: 'Cascade IT Partners', plan: 'partner' })).toEqual({diff --git a/apps/web/src/signup.ts b/apps/web/src/signup.tsindex f54cfa37..b4574b15 100644--- a/apps/web/src/signup.ts+++ b/apps/web/src/signup.ts@@ -1,5 +1,6 @@// The sign-up page's requests (apps/api/src/self-serve.ts and app.ts): whether sign-up is open, the email code with// its checks, and account.signUp. What the page reads from its address: the plan and the interval, nothing else.+import { clearAttribution, readAttribution } from './attribution.ts'import { PARTNER_AGENT_HASH } from './onboarding/setup-choice.ts'/** The plan's prices and the trial at the install's rules (Server admin › Billing), in cents before tax. */@@ -173,7 +174,7 @@ export async function signUpBusiness(method: 'POST',credentials: 'include',headers: { 'content-type': 'application/json' },- body: JSON.stringify(input),+ body: JSON.stringify({ ...input, attribution: readAttribution() }),})const body = (await res.json().catch(() => null)) as {ok?: boolean@@ -182,7 +183,10 @@ export async function signUpBusiness(} | nullconst workspaceId = body?.data?.workspace?.id ?? nullconst partnerId = body?.data?.partner?.id ?? null- if (res.ok && body?.ok && (workspaceId || partnerId)) return { ok: true, workspaceId, partnerId }+ if (res.ok && body?.ok && (workspaceId || partnerId)) {+ clearAttribution()+ return { ok: true, workspaceId, partnerId }+ }if (body?.code === 'already_partner')return { ok: false, notYet: false, closed: false, termsChanged: false, partnerOwned: true }// 409 with `terms_changed`: the terms changed while the page was open (A9); `country_not_served` (an older API: 409diff --git a/packages/actions/src/signup.ts b/packages/actions/src/signup.tsindex 97bdd11e..5d4a6bff 100644--- a/packages/actions/src/signup.ts+++ b/packages/actions/src/signup.ts@@ -13,6 +13,40 @@ import { countryHintSchema } from './workspace-locale.ts'export const SIGNUP_PLANS = ['cloud', 'partner'] as constexport const SIGNUP_INTERVALS = ['year', 'month'] as const+/** A campaign word the page kept (utm_source, utm_medium, utm_campaign): trimmed, lower case, 100 characters at most; nothing usable: dropped. */+const campaignWord = z+ .string()+ .max(500)+ .transform(+ v =>+ v+ // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters out of a value from the address+ .replace(/[\u0000-\u001f\u007f]/g, ' ')+ .replace(/\s+/g, ' ')+ .trim()+ .toLowerCase()+ .slice(0, 100) || undefined,+ )+/** The referring site's host only (never a path or query); anything else: dropped. */+const referrerHost = z+ .string()+ .max(500)+ .transform(v => {+ const host = v.trim().toLowerCase()+ return /^[a-z0-9]([a-z0-9.-]{0,98}[a-z0-9])?$/.test(host) ? host : undefined+ })+/**+ * Where a sign-up came from, as the browser kept it from its first landing (apps/web/src/attribution.ts). Stored once+ * on the user (the first one wins); a value that is no good is dropped, and never refuses a sign-up.+ */+export const signupAttribution = z.object({+ utmSource: campaignWord.optional(),+ utmMedium: campaignWord.optional(),+ utmCampaign: campaignWord.optional(),+ referrer: referrerHost.optional(),+})+export type SignupAttribution = z.infer<typeof signupAttribution>+export const accountSignUp = defineAction({name: 'account.signUp',description:@@ -37,6 +71,8 @@ export const accountSignUp = defineAction({plan: z.enum(SIGNUP_PLANS),interval: z.enum(SIGNUP_INTERVALS),timeZone: z.string().max(64).optional(),+ /** Where the person came from (the first landing the browser kept): stored on the user once, for the sign-up channels. */+ attribution: signupAttribution.optional(),/*** The terms and privacy policy versions the page showed next to its button (GET /v1/signup/config): starting the* plan accepts them (A9). The server records them only when they are still the ones in effect.diff --git a/packages/db/migrations/0194_signup_attribution.sql b/packages/db/migrations/0194_signup_attribution.sqlnew file mode 100644index 00000000..4d4fedf3--- /dev/null+++ b/packages/db/migrations/0194_signup_attribution.sql@@ -0,0 +1,4 @@+ALTER TABLE "user" ADD COLUMN "signup_utm_source" text;--> statement-breakpoint+ALTER TABLE "user" ADD COLUMN "signup_utm_medium" text;--> statement-breakpoint+ALTER TABLE "user" ADD COLUMN "signup_utm_campaign" text;--> statement-breakpoint+ALTER TABLE "user" ADD COLUMN "signup_referrer" text;\ No newline at end of filediff --git a/packages/db/migrations/meta/0194_snapshot.json b/packages/db/migrations/meta/0194_snapshot.jsonnew file mode 100644index 00000000..9d21b1a7--- /dev/null+++ b/packages/db/migrations/meta/0194_snapshot.json@@ -0,0 +1,11496 @@+{+ "id": "6f7cb757-058b-4f4b-88c9-1f6d5bd599db",+ "prevId": "968f3108-a4f5-43ac-8c90-07ac4453e2f9",+ "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+ },+ "retry_chain_id": {+ "name": "retry_chain_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retry_attempt": {+ "name": "retry_attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "retry_state": {+ "name": "retry_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retry_next_at": {+ "name": "retry_next_at",+ "type": "timestamp with time zone",+ "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.outbound_retries": {+ "name": "outbound_retries",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "dial": {+ "name": "dial",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "delays": {+ "name": "delays",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "attempt": {+ "name": "attempt",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 1+ },+ "room": {+ "name": "room",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "state": {+ "name": "state",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'calling'"+ },+ "next_at": {+ "name": "next_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": false+ },+ "refusal": {+ "name": "refusal",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp with time zone",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "outbound_retries_room": {+ "name": "outbound_retries_room",+ "columns": [+ {+ "expression": "room",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": true,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {},+ "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()"+ },+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "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": {}+ },+ "push_subscriptions_session_idx": {+ "name": "push_subscriptions_session_idx",+ "columns": [+ {+ "expression": "session_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "push_subscriptions_session_id_session_id_fk": {+ "name": "push_subscriptions_session_id_session_id_fk",+ "tableFrom": "push_subscriptions",+ "tableTo": "session",+ "columnsFrom": [+ "session_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "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+ },+ "outbound_extra_countries": {+ "name": "outbound_extra_countries",+ "type": "text[]",+ "primaryKey": false,+ "notNull": true,+ "default": "'{}'::text[]"+ },+ "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+ },+ "signup_utm_source": {+ "name": "signup_utm_source",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "signup_utm_medium": {+ "name": "signup_utm_medium",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "signup_utm_campaign": {+ "name": "signup_utm_campaign",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "signup_referrer": {+ "name": "signup_referrer",+ "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 filediff --git a/packages/db/migrations/meta/_journal.json b/packages/db/migrations/meta/_journal.jsonindex 764e6dfd..9964a7b8 100644--- a/packages/db/migrations/meta/_journal.json+++ b/packages/db/migrations/meta/_journal.json@@ -1352,6 +1352,13 @@"when": 1796247335087,"tag": "0193_push_subscription_session","breakpoints": true+ },+ {+ "idx": 193,+ "version": "7",+ "when": 1796319534457,+ "tag": "0194_signup_attribution",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/auth-schema.ts b/packages/db/src/auth-schema.tsindex ee67204d..e6d7a460 100644--- a/packages/db/src/auth-schema.ts+++ b/packages/db/src/auth-schema.ts@@ -33,6 +33,12 @@ export const user = pgTable("user", {// resolved to in their browser (for emails).locale: text("locale"),localeAuto: text("locale_auto"),+ // Not Better Auth's: where the person came from, the first landing the browser kept before the sign-up+ // (apps/api/src/signup-attribution.ts). The campaign's own words, and the referring site's host, never an address.+ signupUtmSource: text("signup_utm_source"),+ signupUtmMedium: text("signup_utm_medium"),+ signupUtmCampaign: text("signup_utm_campaign"),+ signupReferrer: text("signup_referrer"),});export const session = pgTable(diff --git a/packages/i18n/locales/en/admin.json b/packages/i18n/locales/en/admin.jsonindex 4164613d..8efece3e 100644--- a/packages/i18n/locales/en/admin.json+++ b/packages/i18n/locales/en/admin.json@@ -1883,17 +1883,23 @@"users.badge.disabled": "Disabled","users.badge.serverAdmin": "Server admin","users.column.lastSignIn": "Last sign-in",+ "users.column.source": "Source","users.column.user": "User","users.column.workspaces": "Workspaces","users.details": "Details","users.empty": "No users yet.","users.fact.active": "Active",+ "users.fact.campaign": "Campaign","users.fact.created": "Created","users.fact.disabledAt": "Disabled {when}","users.fact.email": "Email","users.fact.lastSignIn": "Last sign-in",+ "users.fact.medium": "Medium","users.fact.no": "No",+ "users.fact.referrer": "Referring site","users.fact.serverAdmin": "Server admin",+ "users.fact.source": "Source",+ "users.fact.sourceNone": "Not recorded","users.fact.status": "Status","users.fact.terms": "Terms accepted","users.fact.termsAccepted": "Version {version}, {when}",