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
Security fixes from the mobile app review (PR 2044)
Tim Gutberlet9870541b37db
diff --git a/apps/api/src/app-sign-in.ts b/apps/api/src/app-sign-in.tsindex 5bf236c8..ad37c9a3 100644--- a/apps/api/src/app-sign-in.ts+++ b/apps/api/src/app-sign-in.ts@@ -5,15 +5,16 @@// 1. The app makes a random verifier and opens `/app-sign-in?provider=…&challenge=<SHA-256 of it>` in the browser.// The page posts the challenge to `/app-sign-in/start`, which keeps it with the time in a signed, httpOnly cookie// of that browser (15 minutes), then goes to the provider.-// 2. Back from the provider, the page asks the person to confirm ("Sign in to the Linedesk app as …?"); only then does-// it ask `/app-sign-in/code`. A code is given only for a session the provider sign-in made after step 1's start+// 2. Back from the provider, the page asks the person to confirm (continue only if they just tapped Sign in in the+// app on this phone); only then does it ask `/app-sign-in/code`. A code is given only for a session the provider sign-in made after step 1's start// (an older session of that browser never counts), once per start: one use, 2 minutes, stored hashed with the user,// the challenge and the browser's session. The page sends it to the app on the server's own https address// (`/app-sign-in/back?code=…`), which only the real app can receive (universal link / verified app link, app-links.ts).// 3. The app's web view redeems it with the verifier (`/app-sign-in/redeem`): only the app that started the sign-in// knows the verifier. The browser's session must still exist (a password reset or "sign out everywhere" in between// ends the hand-back too) and is ended then; the web view's own older session too. The new session is made by-// Better Auth's adapter, so every session hook runs (disabled accounts, the audit log with method `app`, the host).+// Better Auth's adapter, so every session hook runs: a disabled account is refused (instance-admin.ts, session+// create before: ACCOUNT_DISABLED), the audit log gets method `app`, the host is kept (host-sessions.ts).// Every endpoint checks the request's origin like Better Auth's own sign-in endpoints (formCsrfMiddleware), so another// site's form can neither start nor redeem (security review of #1997, H1, H2, L1, L2).import { randomBytes } from 'node:crypto'diff --git a/apps/api/src/app.ts b/apps/api/src/app.tsindex c8cf0532..90e6c95a 100644--- a/apps/api/src/app.ts+++ b/apps/api/src/app.ts@@ -29,6 +29,8 @@ import { bodyLimit } from 'hono/body-limit'const ACTION_BODY_MAX_BYTES = 4 * 1024 * 1024/** feedback.send: a screenshot of up to 3 MB, base64 (4 MB), plus the text and context. */const FEEDBACK_BODY_MAX_BYTES = 5 * 1024 * 1024+/** Every Better Auth request (/api/auth/*): its bodies are a few KB at most (a passkey response is the largest). */+export const AUTH_MAX_BODY_BYTES = 64 * 1024import { setFirstPassword } from './account.ts'import { registerDemoCallRoutes } from './demo-call.ts'import { API_KEY_REQUESTS_PER_MINUTE, apiKeyWithinLimit, isApiKey, keyOf, tooManyInvalidApiKeys } from './api-keys.ts'@@ -214,6 +216,10 @@ app.get('/v1/health/host', c => {if (!probed) return c.json({ ok: false, error: 'not found' }, 404)return c.json({ ok: true, domainId: probed.domainId, proof: probed.proof })})+// Every Better Auth request body (sign-in, sign-up, passkeys, two-factor, the app sign-in hand-back) is a small JSON or+// form body, a few KB at most (a passkey's attestation is the largest, about 1-2 KB): one limit for all, so no endpoint+// reads an unbounded body (security review of the mobile app, LIN-874). Apple's callback below keeps its own, lower one.+app.use('/api/auth/*', bodyLimit({ maxSize: AUTH_MAX_BODY_BYTES, onError: c => c.body(null, 413) }))// Apple comes back with a cross-site form POST: answered as the GET every other provider sends (apple-sign-in.ts).app.post('/api/auth/callback/apple',diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.tsindex 6ddea676..92f939af 100644--- a/apps/api/src/auth.ts+++ b/apps/api/src/auth.ts@@ -335,7 +335,12 @@ export const auth = betterAuth({// expires: at most PASSKEY_CHALLENGE_LIMIT per minute per address (expired ones are deleted daily, verifications.ts).rateLimit: { enabled: true, customRules: { [PASSKEY_CHALLENGE_PATH]: PASSKEY_CHALLENGE_LIMIT } },// The client address comes from our own header (client-ip.ts), never from one the client sets.- advanced: { ipAddress: { ipAddressHeaders: [CLIENT_IP_HEADER] } },+ // The origin check is on: Better Auth turns it off by itself when NODE_ENV is `test` or a TEST variable is set, and a+ // stray TEST on a server must not do that. Only the API tests (NODE_ENV=test) keep Better Auth's default.+ advanced: {+ ipAddress: { ipAddressHeaders: [CLIENT_IP_HEADER] },+ ...(process.env.NODE_ENV === 'test' ? {} : { disableOriginCheck: false }),+ },// Members and invitations change only through the team.* actions (team.ts), which apply the// workspace's rules (last owner, who may change an owner). Accepting stays Better Auth's endpoint.disabledPaths: [diff --git a/apps/api/src/native-push.test.ts b/apps/api/src/native-push.test.tsindex 0600539b..7ac9c61a 100644--- a/apps/api/src/native-push.test.ts+++ b/apps/api/src/native-push.test.ts@@ -60,14 +60,14 @@ describe('the notification', () => {})})- it('FCM: the calls channel, newer news about the call replaces older', () => {+ it('FCM: the calls channel, private on the lock screen, newer news about the call replaces older', () => {const { message } = fcmMessage('tok', payload)expect(message.token).toBe('tok')expect(message.data).toEqual({ callId: 'call_1', kind: 'urgent' })expect(message.android).toMatchObject({priority: 'HIGH',collapse_key: 'call_1',- notification: { tag: 'call_1', channel_id: 'calls' },+ notification: { tag: 'call_1', channel_id: 'calls-v2', visibility: 'PRIVATE' },})})})@@ -96,6 +96,9 @@ describe('sendFcm', () => {{ status: 404 },)expect(await sendFcm(config, 'tok', payload, 1000, fakeGoogle(gone).doFetch)).toBe('gone')+ // A 404 without UNREGISTERED (a wrong project, a proxy) says nothing about the phone: an error, the device stays.+ const notFound = Response.json({ error: { status: 'NOT_FOUND' } }, { status: 404 })+ await expect(sendFcm(config, 'tok', payload, 1000, fakeGoogle(notFound).doFetch)).rejects.toThrow(/404/)await expect(sendFcm(config, 'tok', payload, 1000, fakeGoogle(new Response('', { status: 503 })).doFetch),).rejects.toThrow(/503/)diff --git a/apps/api/src/native-push.ts b/apps/api/src/native-push.tsindex 28825c24..bf4d746c 100644--- a/apps/api/src/native-push.ts+++ b/apps/api/src/native-push.ts@@ -7,6 +7,7 @@import { createHash, createPrivateKey, sign } from 'node:crypto'import { type ClientHttp2Session, connect } from 'node:http2'import type { Tx } from '@linedesk/db'+import { ANDROID_CALLS_CHANNEL } from '@linedesk/actions'import { resolveProvider } from './provider-settings.ts'import type { PushPayload } from './push.ts'@@ -260,7 +261,10 @@ async function fcmAccessToken(config: FcmConfig, doFetch: typeof fetch, timeoutMreturn body.access_token}-/** The message as FCM HTTP v1 takes it: a notification on the "calls" channel, newer news replacing older. */+/**+ * The message as FCM HTTP v1 takes it: a notification on the app's calls channel, newer news replacing older; private on+ * the lock screen (only that a notification came, not who called or why), whatever the channel says.+ */export function fcmMessage(deviceToken: string, payload: PushPayload) {return {message: {@@ -271,7 +275,7 @@ export function fcmMessage(deviceToken: string, payload: PushPayload) {priority: payload.urgent ? 'HIGH' : 'NORMAL',ttl: `${TTL_SECONDS}s`,collapse_key: payload.callId,- notification: { tag: payload.callId, channel_id: 'calls' },+ notification: { tag: payload.callId, channel_id: ANDROID_CALLS_CHANNEL, visibility: 'PRIVATE' },},},}@@ -299,10 +303,10 @@ export async function sendFcm(error?: { status?: string; details?: { errorCode?: string }[] }}const codes = [body.error?.status, ...(body.error?.details ?? []).map(d => d.errorCode)]- // The app was removed, or the token was never one of this app's.- // Only these say the phone is gone; INVALID_ARGUMENT or SENDER_ID_MISMATCH can be our message or the project, which- // must not delete devices (review of #1999).- if (res.status === 404 || codes.includes('UNREGISTERED')) return 'gone'+ // The app was removed, or the token was never one of this app's: FCM says UNREGISTERED (with a 404). Only that says the+ // phone is gone; a 404 without it (a wrong project id, a proxy), INVALID_ARGUMENT or SENDER_ID_MISMATCH can be our+ // message or the project, which must not delete devices (review of #1999; LIN-874).+ if (codes.includes('UNREGISTERED')) return 'gone'if (res.status === 401) fcmAccess.delete(fingerprint(config.projectId, config.clientEmail, config.privateKey))throw new Error(`FCM answered ${res.status}${body.error?.status ? ` (${body.error.status.slice(0, 40)})` : ''}`)}diff --git a/apps/api/src/personal-key-scope.ts b/apps/api/src/personal-key-scope.tsindex de7797cb..7e052938 100644--- a/apps/api/src/personal-key-scope.ts+++ b/apps/api/src/personal-key-scope.ts@@ -40,8 +40,9 @@ export const PERSONAL_KEY_REFUSED: ReadonlyMap<string, string> = new Map([['impersonation.stop', BROWSER],// Edits during an impersonation belong to that browser session (impersonation-guard.ts).['impersonation.setEdits', BROWSER],- // Push subscriptions belong to a browser; listening in and taking over play the call's audio there.+ // Push subscriptions belong to a browser or the app on a phone; listening in and taking over play the call's audio there.['push.subscribe', BROWSER],+ ['push.registerDevice', BROWSER],['push.unsubscribe', BROWSER],['call.listen', BROWSER],['call.takeOver', BROWSER],diff --git a/apps/api/src/push.ts b/apps/api/src/push.tsindex 01f33918..50d9ba64 100644--- a/apps/api/src/push.ts+++ b/apps/api/src/push.ts@@ -12,9 +12,18 @@ import {type PushSettings,pushDeviceId,} from '@linedesk/actions'-import { calls, contacts, member, member_notification_settings, push_subscriptions, type Tx, user } from '@linedesk/db'+import {+ calls,+ contacts,+ member,+ member_notification_settings,+ push_subscriptions,+ session,+ type Tx,+ user,+} from '@linedesk/db'import type { Call } from '@linedesk/db/types'-import { and, desc, eq, inArray, isNull, ne } from 'drizzle-orm'+import { and, desc, eq, gt, inArray, isNull, ne, or } from 'drizzle-orm'import webpush from 'web-push'import { localeForUser } from '@linedesk/i18n/server'import { formatNumber } from './call-notifications.ts'@@ -136,7 +145,19 @@ export function pushPayload(export type PushResult = { sent: number; gone: number; failed: number; skipped?: 'missing' | 'test' | 'spam' | 'off' }-/** Members of the call's workspace (still members, not disabled) with push on, per browser; with `userId` only theirs. */+/**+ * A subscription whose sign-in still counts (with a left join of `session` on push_subscriptions.session_id): a session+ * that was ended (Settings › Sessions, a password change or reset) takes its rows with it (ON DELETE CASCADE), and an+ * expired one, which Better Auth deletes only later, is left out here. A row without a session (made before the column)+ * still counts until the app or the web app starts again signed in, which registers it again with its session (apps/web/src/push.ts+ * refreshPushHere).+ */+const liveSubscription = () => or(isNull(push_subscriptions.session_id), gt(session.expiresAt, new Date()))++/**+ * Members of the call's workspace (still members, not disabled) with push on, per browser; with `userId` only theirs.+ * Only browsers and phones whose sign-in still counts (liveSubscription).+ */async function pushRecipients(tx: Tx, workspaceId: string, userId?: string) {return tx.select({@@ -153,6 +174,7 @@ async function pushRecipients(tx: Tx, workspaceId: string, userId?: string) {and(eq(member.organizationId, push_subscriptions.workspace_id), eq(member.userId, push_subscriptions.user_id)),).innerJoin(user, eq(user.id, push_subscriptions.user_id))+ .leftJoin(session, eq(session.id, push_subscriptions.session_id)).leftJoin(member_notification_settings,and(@@ -164,6 +186,7 @@ async function pushRecipients(tx: Tx, workspaceId: string, userId?: string) {and(eq(push_subscriptions.workspace_id, workspaceId),isNull(user.disabledAt),+ liveSubscription(),userId ? eq(push_subscriptions.user_id, userId) : undefined,),)@@ -305,7 +328,7 @@ export function assignedPushPayload(return { callId: call.id, kind: 'assigned', urgent: call.urgency === 'urgent', title, body: oneLine(body) }}-/** The caller's push settings in their workspace, for notifications.get. */+/** The caller's push settings in their workspace, for notifications.get: only the devices that get pushes. */export async function pushSettings(tx: Tx,workspaceId: string,@@ -315,7 +338,10 @@ export async function pushSettings(const rows = await tx.select({ endpoint: push_subscriptions.endpoint }).from(push_subscriptions)- .where(and(eq(push_subscriptions.workspace_id, workspaceId), eq(push_subscriptions.user_id, userId)))+ .leftJoin(session, eq(session.id, push_subscriptions.session_id))+ .where(+ and(eq(push_subscriptions.workspace_id, workspaceId), eq(push_subscriptions.user_id, userId), liveSubscription()),+ )const native = await nativePushConfigs(tx)return {publicKey: pushSender().publicKey,@@ -350,11 +376,15 @@ function pushPerson(actor: Actor): { workspaceId: string; userId: string } {return { workspaceId: actor.workspaceId, userId: actor.actorId }}-/** Also not an instance admin acting as someone else: their browser must not get that person's pushes. */-function pushMember(actor: Actor): { workspaceId: string; userId: string } {+/**+ * Also not an instance admin acting as someone else: their browser must not get that person's pushes. With the session+ * that turns push on: the subscription ends with it (push_subscriptions.session_id).+ */+function pushMember(actor: Actor): { workspaceId: string; userId: string; sessionId: string } {const person = pushPerson(actor)if (actor.impersonation) throw new Forbidden('push notifications cannot be changed while acting as someone else')- return person+ if (!actor.sessionId) throw Reject.t('server.api.push.needsSession')+ return { ...person, sessionId: actor.sessionId }}/**@@ -375,6 +405,26 @@ async function claimEndpoint(tx: Tx, userId: string, input: PushTarget) {.where(and(eq(push_subscriptions.endpoint, input.endpoint), ne(push_subscriptions.user_id, userId)))}+/**+ * Whether the member already has this browser or phone in the workspace: registering it again (every start of the app+ * and the web app, to tie it to the current session) is no new device and is not counted against allowSubscribe.+ */+async function ownDevice(tx: Tx, workspaceId: string, userId: string, endpoint: string) {+ const [row] = await tx+ .select({ endpoint: push_subscriptions.endpoint })+ .from(push_subscriptions)+ .where(+ and(+ eq(push_subscriptions.workspace_id, workspaceId),+ eq(push_subscriptions.user_id, userId),+ eq(push_subscriptions.endpoint, endpoint),+ ),+ )+ return Boolean(row)+}++const TOO_MANY = 'too many push subscriptions in the last hour; try again later'+/** Keeps the member's newest MAX_PUSH_DEVICES browsers in the workspace. */async function keepNewestDevices(tx: Tx, workspaceId: string, userId: string) {const mine = and(eq(push_subscriptions.workspace_id, workspaceId), eq(push_subscriptions.user_id, userId))@@ -389,12 +439,13 @@ async function keepNewestDevices(tx: Tx, workspaceId: string, userId: string) {export const pushHandlers: Record<string, Handler> = {'push.subscribe': async ({ tx, actor, now }, input: PushTarget) => {- const { workspaceId, userId } = pushMember(actor)+ const { workspaceId, userId, sessionId } = pushMember(actor)if (!pushSender().publicKey) throw new Reject('push notifications are not set up on this server')- if (!allowSubscribe(userId)) throw new Reject('too many push subscriptions in the last hour; try again later')+ if (!(await ownDevice(tx, workspaceId, userId, input.endpoint)) && !allowSubscribe(userId))+ throw new Reject(TOO_MANY)await claimEndpoint(tx, userId, input)- const values = { endpoint: input.endpoint, p256dh: input.keys.p256dh, auth: input.keys.auth }- // Subscribing again counts as the newest device. Only ever the caller's own row is updated.+ const values = { endpoint: input.endpoint, p256dh: input.keys.p256dh, auth: input.keys.auth, session_id: sessionId }+ // Subscribing again counts as the newest device and ties it to this session. Only ever the caller's own row is updated.await tx.insert(push_subscriptions).values({ workspace_id: workspaceId, user_id: userId, ...values, created_at: now })@@ -410,22 +461,21 @@ export const pushHandlers: Record<string, Handler> = {// The Linedesk app on a phone (iOS: APNs, Android: FCM; native-push.ts). A token is one install of the app on one// phone: a row of someone else with it means the phone changed hands without signing out, so theirs goes.'push.registerDevice': async ({ tx, actor, now }, input: { platform: 'ios' | 'android'; token: string }) => {- const { workspaceId, userId } = pushMember(actor)+ const { workspaceId, userId, sessionId } = pushMember(actor)const native = await nativePushConfigs(tx)- if (!(input.platform === 'ios' ? native.apns : native.fcm))- throw Reject.t('server.api.push.appNotSetUp')- if (!allowSubscribe(userId)) throw new Reject('too many push subscriptions in the last hour; try again later')+ if (!(input.platform === 'ios' ? native.apns : native.fcm)) throw Reject.t('server.api.push.appNotSetUp')const endpoint = nativePushEndpoint(input.platform, input.token)+ if (!(await ownDevice(tx, workspaceId, userId, endpoint)) && !allowSubscribe(userId)) throw new Reject(TOO_MANY)await tx.delete(push_subscriptions).where(and(eq(push_subscriptions.endpoint, endpoint), ne(push_subscriptions.user_id, userId)))- const values = { endpoint, p256dh: '', auth: '' }+ const values = { endpoint, p256dh: '', auth: '', session_id: sessionId }await tx.insert(push_subscriptions).values({ workspace_id: workspaceId, user_id: userId, ...values, created_at: now }).onConflictDoUpdate({target: [push_subscriptions.workspace_id, push_subscriptions.endpoint],- set: { created_at: now },+ set: { created_at: now, session_id: sessionId },setWhere: eq(push_subscriptions.user_id, userId),})await keepNewestDevices(tx, workspaceId, userId)diff --git a/apps/api/test/app-sign-in.test.ts b/apps/api/test/app-sign-in.test.tsnew file mode 100644index 00000000..54553f7d--- /dev/null+++ b/apps/api/test/app-sign-in.test.ts@@ -0,0 +1,128 @@+// The sign-in hand-back of the Linedesk app (app-sign-in.ts) through its real endpoints: a browser starts it with the+// app's challenge, signs in, asks for a code; the app's web view redeems the code with its verifier. Another site can+// use none of the endpoints, a code works once and only with its verifier, and only while the browser's sign-in lasts.+import { randomBytes } from 'node:crypto'+import { session, user } from '@linedesk/db'+import { eq } from 'drizzle-orm'+import { describe, expect, test, vi } from 'vitest'++// Better Auth skips its origin checks when NODE_ENV is `test` or TEST is set (vitest sets both). auth.ts keeps them on+// unless NODE_ENV is `test`: this file runs as a server does, with TEST still set, so a stray TEST cannot turn them off.+vi.hoisted(() => {+ process.env.NODE_ENV = 'development'+})++const { AUTH_MAX_BODY_BYTES } = await import('../src/app.ts')+const { sha256 } = await import('../src/app-sign-in-pkce.ts')+const { db } = await import('../src/db.ts')+const { appRequest, FROM, randomIp, signIn, signUp } = await import('./helpers.ts')++const ORIGIN = 'http://localhost:5173'+const EVIL = 'https://evil.example'+const token = () => randomBytes(32).toString('base64url')++const cookiesOf = (res: Response) =>+ res.headers+ .getSetCookie()+ .map(c => c.split(';')[0]!)+ .filter(c => !c.endsWith('='))+ .join('; ')++function post(path: string, body: unknown, { cookie, origin = ORIGIN }: { cookie?: string; origin?: string } = {}) {+ return appRequest(`/api/auth${path}`, {+ method: 'POST',+ headers: {+ 'content-type': 'application/json',+ origin,+ [FROM]: randomIp(),+ ...(cookie ? { cookie } : {}),+ },+ body: JSON.stringify(body),+ })+}++const emailOf = async (userId: string) =>+ (await db.select({ email: user.email }).from(user).where(eq(user.id, userId)))[0]!.email++/** A browser that started the hand-back with the app's challenge and then signed in: its cookies and session. */+async function browserSignedIn() {+ const who = await signUp()+ const verifier = token()+ const started = await post('/app-sign-in/start', { challenge: sha256(verifier) })+ expect(started.status).toBe(200)+ const startCookie = cookiesOf(started)+ expect(startCookie).toBeTruthy()+ const sessionCookie = await signIn(await emailOf(who.userId), startCookie)+ const cookie = `${startCookie}; ${sessionCookie}`+ const sessions = await db.select().from(session).where(eq(session.userId, who.userId))+ const browserSession = sessions.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())[0]!+ return { who, verifier, cookie, browserSession }+}++async function codeFor(cookie: string) {+ const res = await post('/app-sign-in/code', {}, { cookie })+ expect(res.status).toBe(200)+ return ((await res.json()) as { code: string }).code+}++const sessionExists = async (id: string) => (await db.select().from(session).where(eq(session.id, id))).length > 0++describe('app sign-in hand-back', () => {+ test('the app redeems the code with its verifier once: a new session, the browser session ends', async () => {+ const { who, verifier, cookie, browserSession } = await browserSignedIn()+ const code = await codeFor(cookie)+ const redeemed = await post('/app-sign-in/redeem', { code, verifier })+ expect(redeemed.status).toBe(200)+ const appCookie = cookiesOf(redeemed)+ expect(appCookie).toContain('session_token')+ expect(await sessionExists(browserSession.id)).toBe(false)+ const me = await appRequest('/api/auth/get-session', { headers: { cookie: appCookie, origin: ORIGIN } })+ expect(((await me.json()) as { user: { id: string } }).user.id).toBe(who.userId)+ // A second redeem of the same code is refused.+ expect((await post('/app-sign-in/redeem', { code, verifier })).status).toBe(401)+ })++ test('another site can neither start, ask for a code nor redeem', async () => {+ expect((await post('/app-sign-in/start', { challenge: sha256(token()) }, { origin: EVIL })).status).toBe(403)+ const { verifier, cookie, browserSession } = await browserSignedIn()+ expect((await post('/app-sign-in/code', {}, { cookie, origin: EVIL })).status).toBe(403)+ const code = await codeFor(cookie)+ expect((await post('/app-sign-in/redeem', { code, verifier }, { origin: EVIL })).status).toBe(403)+ // The refused try did not spend the code, nor end the browser's session.+ expect(await sessionExists(browserSession.id)).toBe(true)+ expect((await post('/app-sign-in/redeem', { code, verifier })).status).toBe(200)+ })++ test('a wrong verifier spends the code: the right one no longer works', async () => {+ const { verifier, cookie, browserSession } = await browserSignedIn()+ const code = await codeFor(cookie)+ expect((await post('/app-sign-in/redeem', { code, verifier: token() })).status).toBe(401)+ expect((await post('/app-sign-in/redeem', { code, verifier })).status).toBe(401)+ expect(await sessionExists(browserSession.id)).toBe(true)+ })++ test('the code is refused once the browser session is signed out', async () => {+ const { verifier, cookie, browserSession } = await browserSignedIn()+ const code = await codeFor(cookie)+ await db.delete(session).where(eq(session.id, browserSession.id))+ const refused = await post('/app-sign-in/redeem', { code, verifier })+ expect(refused.status).toBe(401)+ expect(cookiesOf(refused)).not.toContain('session_token')+ })++ test('a session of the browser from before the start gets no code', async () => {+ const who = await signUp()+ const started = await post('/app-sign-in/start', { challenge: sha256(token()) }, { cookie: who.headers.cookie })+ const cookie = `${cookiesOf(started)}; ${who.headers.cookie}`+ expect((await post('/app-sign-in/code', {}, { cookie })).status).toBe(401)+ })+})++describe('the body limit of every Better Auth request', () => {+ test(`a body over ${AUTH_MAX_BODY_BYTES / 1024} KB is refused before Better Auth reads it; a normal one passes`, async () => {+ const big = await post('/sign-in/email', { email: '[email protected]', password: 'p'.repeat(AUTH_MAX_BODY_BYTES) })+ expect(big.status).toBe(413)+ const normal = await post('/sign-in/email', { email: '[email protected]', password: 'not-the-password-1' })+ expect(normal.status).not.toBe(413)+ })+})diff --git a/apps/api/test/helpers.ts b/apps/api/test/helpers.tsindex cf4b5a3c..7b210a87 100644--- a/apps/api/test/helpers.ts+++ b/apps/api/test/helpers.ts@@ -72,17 +72,29 @@ export async function signUp(email = `${uid('user')}@linedesk.test`): Promise<Usawait db.insert(accounts).values({ id: uid('acc'), accountId: id, providerId: 'credential', userId: id, password: await passwordHash })+ return { userId: id, headers: { cookie: await signIn(email), origin: ORIGIN } }+}++/**+ * Signs in to an account made by signUp once more, as another browser would: a new session. Returns the cookies of the+ * answer; `cookie`: what the browser sent along (another cookie of that browser).+ */+export async function signIn(email: string, cookie?: string): Promise<string> {const res = await appRequest('/api/auth/sign-in/email', {method: 'POST',- headers: { 'content-type': 'application/json', origin: ORIGIN, [FROM]: randomIp() },+ headers: {+ 'content-type': 'application/json',+ origin: ORIGIN,+ [FROM]: randomIp(),+ ...(cookie ? { cookie } : {}),+ },body: JSON.stringify({ email, password: PASSWORD }),})if (!res.ok) throw new Error(`sign-in failed: ${res.status} ${await res.text()}`)- const cookie = res.headers+ return res.headers.getSetCookie().map(c => c.split(';')[0]).join('; ')- return { userId: id, headers: { cookie, origin: ORIGIN } }}/** The voice agent; each from its own address, so wrong tokens in one test never throttle another (context.ts). */diff --git a/apps/api/test/push.test.ts b/apps/api/test/push.test.tsindex a143aa20..9455f86a 100644--- a/apps/api/test/push.test.ts+++ b/apps/api/test/push.test.ts@@ -1,13 +1,15 @@// Web Push: members subscribe their own browsers per workspace, the subscription never comes back// and is redacted in the command log, pushes carry only who called (plus one line when opted in),-// and subscriptions go when a member leaves, is removed or is disabled, or the push service drops them.+// and subscriptions go when a member leaves, is removed or is disabled, the session that made them ends, or the push+// service drops them.import { pushDeviceId } from '@linedesk/actions'-import { calls, commands, member, push_subscriptions, user } from '@linedesk/db'+import { calls, commands, member, push_subscriptions, session, user } from '@linedesk/db'import { and, eq } from 'drizzle-orm'import type { PgBoss } from 'pg-boss'import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'import webpush from 'web-push'import { db } from '../src/db.ts'+import { emailSender } from '../src/email.ts'import { CALL_PUSH, setJobQueue } from '../src/jobs.ts'import {MAX_PUSH_DEVICES,@@ -20,7 +22,18 @@ import {pushSenderFromEnv,setPushSender,} from '../src/push.ts'-import { act, addMember, agent, createWorkspace, getCall, randomNumber, type User, type Workspace } from './helpers.ts'+import {+ act,+ addMember,+ agent,+ createWorkspace,+ getCall,+ randomNumber,+ request,+ signIn,+ type User,+ type Workspace,+} from './helpers.ts'const endpointFor = (name: string) => `https://fcm.googleapis.com/fcm/send/${name}-${crypto.randomUUID()}`const keys = { p256dh: 'BPublicKeyOfTheBrowser', auth: 'authSecret' }@@ -144,6 +157,8 @@ describe('subscriptions', () => {for (let i = MAX_PUSH_DEVICES + 2; i < 20; i++) await subscribe(ws.owner, `more${i}`)const refused = await act(ws.owner, 'push.subscribe', { endpoint: endpointFor('one-too-many'), keys })expect(refused).toMatchObject({ status: 409, body: { error: expect.stringMatching(/too many/) } })+ // Registering a device it already has again (every start, for the current session) is no new device: not limited.+ expect((await act(ws.owner, 'push.subscribe', { endpoint: kept[0], keys })).status).toBe(200)// Someone else is not affected.await subscribe(await addMember(ws.id, 'member'))})@@ -201,6 +216,112 @@ describe('subscriptions', () => {})})+describe('the session that turned push on', () => {+ const ORIGIN = 'http://localhost:5173'+ const PASSWORD = 'test-password-1234' // helpers.ts signUp++ /** The member signed in a second time, as on another phone or browser: its own session. */+ async function secondSession(who: User, workspaceId: string) {+ const [account] = await db.select({ email: user.email }).from(user).where(eq(user.id, who.userId))+ const cookie = await signIn(account!.email)+ const caller: User = { userId: who.userId, headers: { cookie, origin: ORIGIN, 'x-workspace-id': workspaceId } }+ const sessions = await db.select().from(session).where(eq(session.userId, who.userId))+ const newest = sessions.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())[0]!+ return { caller, sessionId: newest.id, token: newest.token, email: account!.email }+ }++ async function pushedTo(ws: Workspace) {+ const { sender, sent } = fakeSender()+ await notifyCallPush(db, sender, (await callIn(ws)).id, 'finished')+ return sent.map(s => s.to).sort()+ }++ test('a subscription is tied to the session that made it; subscribing again ties it to the new one', async () => {+ const ws = await createWorkspace('Session Push Plumbing')+ const phone = await secondSession(ws.owner, ws.id)+ const endpoint = await subscribe(phone.caller, 'phone')+ expect((await rowsOf(ws.owner)).map(r => r.session_id)).toEqual([phone.sessionId])+ // The same browser subscribes again in another session (signed in again): now that one's.+ await act(ws.owner, 'push.subscribe', { endpoint, keys })+ const [row] = await rowsOf(ws.owner)+ expect(row!.session_id).not.toBe(phone.sessionId)+ expect(row!.session_id).toBeTruthy()+ })++ test('Settings › Sessions: signing out another session ends its pushes, the others keep theirs', async () => {+ const ws = await createWorkspace('Revoke Push Plumbing')+ const phone = await secondSession(ws.owner, ws.id)+ const laptop = await subscribe(ws.owner, 'laptop')+ const onPhone = await subscribe(phone.caller, 'phone')+ expect(await pushedTo(ws)).toEqual([laptop, onPhone].sort())++ const revoked = await request(ws.owner, 'POST', '/api/auth/revoke-session', { token: phone.token })+ expect(revoked.status).toBe(200)+ expect((await rowsOf(ws.owner)).map(r => r.endpoint)).toEqual([laptop])+ expect(await pushedTo(ws)).toEqual([laptop])+ })++ test('a password change that signs out the other sessions ends their pushes', async () => {+ const ws = await createWorkspace('Password Push Plumbing')+ const phone = await secondSession(ws.owner, ws.id)+ await subscribe(ws.owner, 'laptop')+ await subscribe(phone.caller, 'phone')+ const changed = await request(phone.caller, 'POST', '/api/auth/change-password', {+ currentPassword: PASSWORD,+ newPassword: 'a-brand-new-password-42',+ revokeOtherSessions: true,+ })+ expect(changed.status).toBe(200)+ // Better Auth ends every session of the account and gives the phone a new one: the phone turns push on again.+ expect(await rowsOf(ws.owner)).toEqual([])+ expect(await pushedTo(ws)).toEqual([])+ })++ test('a password reset ends every session and so every push', async () => {+ const ws = await createWorkspace('Reset Push Plumbing')+ const phone = await secondSession(ws.owner, ws.id)+ await subscribe(ws.owner, 'laptop')+ await subscribe(phone.caller, 'phone')+ const send = vi.spyOn(emailSender, 'send').mockResolvedValue(undefined)+ try {+ const anon = { headers: { origin: ORIGIN } }+ await request(anon, 'POST', '/api/auth/email-otp/request-password-reset', { email: phone.email })+ const codeMail = () => send.mock.calls.map(([m]) => m).find(m => m.subject.includes('password reset code'))+ await vi.waitFor(() => expect(codeMail()).toBeTruthy())+ const otp = codeMail()!.subject.slice(0, 6)+ const reset = await request(anon, 'POST', '/api/auth/email-otp/reset-password', {+ email: phone.email,+ otp,+ password: 'a-brand-new-password-42',+ })+ expect(reset.status).toBe(200)+ } finally {+ send.mockRestore()+ }+ expect(await rowsOf(ws.owner)).toEqual([])+ expect(await pushedTo(ws)).toEqual([])+ })++ test('an expired session gets no pushes; a subscription from before sessions were stored still does', async () => {+ const ws = await createWorkspace('Expired Push Plumbing')+ const phone = await secondSession(ws.owner, ws.id)+ const laptop = await subscribe(ws.owner, 'laptop')+ await subscribe(phone.caller, 'phone')+ await db+ .update(session)+ .set({ expiresAt: new Date(Date.now() - 60_000) })+ .where(eq(session.id, phone.sessionId))+ const legacy = endpointFor('legacy')+ await db+ .insert(push_subscriptions)+ .values({ workspace_id: ws.id, user_id: ws.owner.userId, endpoint: legacy, ...keys })+ expect(await pushedTo(ws)).toEqual([laptop, legacy].sort())+ // Settings list only the devices that get pushes.+ const { devices } = (await act(ws.owner, 'notifications.get', {})).body.data.push+ expect(devices.sort()).toEqual((await Promise.all([laptop, legacy].map(e => pushDeviceId(e)))).sort())+ })+})+describe('sending', () => {test('in parallel, a few at a time; a push service that does not answer times out without holding up the rest', async () => {const ws = await createWorkspace('Parallel Push Plumbing')diff --git a/apps/web/src/native/init.test.ts b/apps/web/src/native/init.test.tsnew file mode 100644index 00000000..f3469a05--- /dev/null+++ b/apps/web/src/native/init.test.ts@@ -0,0 +1,23 @@+// Links that open the Linedesk app (universal links / app links): only the start page loads in the app's web view.+import { describe, expect, it } from 'vitest'+import { pageToOpen } from './init.ts'++const origin = 'https://app.linedesk.ai'++describe('pageToOpen', () => {+ it('opens the start page of the own server, with the page in the hash', () => {+ expect(pageToOpen('https://app.linedesk.ai/', origin)).toBe(true)+ expect(pageToOpen('https://app.linedesk.ai/#call/call_1', origin)).toBe(true)+ expect(pageToOpen('https://app.linedesk.ai/?ref=email#settings/notifications', origin)).toBe(true)+ })++ it('never the sign-in hand-back, another path or another server', () => {+ expect(pageToOpen('https://app.linedesk.ai/app-sign-in/back?code=x', origin)).toBe(false)+ expect(pageToOpen('https://app.linedesk.ai/v1/actions/push.subscribe', origin)).toBe(false)+ expect(pageToOpen('https://app.linedesk.ai/api/auth/sign-out', origin)).toBe(false)+ expect(pageToOpen('https://app.linedesk.ai/app-sign-in', origin)).toBe(false)+ expect(pageToOpen('https://evil.example/', origin)).toBe(false)+ expect(pageToOpen('http://app.linedesk.ai/', origin)).toBe(false)+ expect(pageToOpen('not a url', origin)).toBe(false)+ })+})diff --git a/apps/web/src/native/init.ts b/apps/web/src/native/init.tsindex 4ac01a9e..1374099f 100644--- a/apps/web/src/native/init.ts+++ b/apps/web/src/native/init.ts@@ -1,18 +1,22 @@// What the web app does once at start inside the Linedesk app (apps/mobile): the status bar, the splash screen, the// Android back button, links from emails (universal links / app links) and the page's edges around the notch.// Nothing here runs in a browser.-import { APP_SIGN_IN_BACK_PATH } from './appSignIn.ts'+import { i18n } from '../i18n/index.tsx'import { App, Keyboard, SplashScreen, StatusBar } from './plugins.ts'+import { prepareNativePush } from './push.ts'import { nativePlatform } from './platform.ts'/**- * A link to the app's own server that should show here: any but the sign-in hand-back, which belongs to the sign-in- * that waits for it (native/appSignIn.ts). Links elsewhere open in the system browser (Capacitor's default).+ * A link to the app's own server that should show here: only its start page (`/`, with the page in the hash, as links+ * in emails are), the one path besides the sign-in hand-back that the app claims (apps/api/src/app-links.ts, the+ * Android intent filter). The hand-back belongs to the sign-in that waits for it (native/appSignIn.ts); any other path+ * (the API, a download) never loads in the app's web view. Links elsewhere open in the system browser (Capacitor's+ * default).*/-const pageToOpen = (url: string) => {+export const pageToOpen = (url: string, origin = window.location.origin) => {try {const u = new URL(url)- return u.origin === window.location.origin && u.pathname !== APP_SIGN_IN_BACK_PATH+ return u.origin === origin && u.pathname === '/'} catch {return false}@@ -56,8 +60,12 @@ export function startNativeApp() {})}-/** After the first paint of the app: the splash screen goes. */+/**+ * After the first paint of the app (its language is loaded): the splash screen goes, and when the phone already allows+ * notifications, Android's calls channel is made (native/push.ts prepareNativePush), signed in or not.+ */export function nativeAppReady() {if (!nativePlatform()) returnvoid SplashScreen.hide({ fadeOutDuration: 150 }).catch(() => {})+ void prepareNativePush(i18n().t('account.notify.callsChannel')).catch(() => {})}diff --git a/apps/web/src/native/plugins.ts b/apps/web/src/native/plugins.tsindex d73d626b..8f662772 100644--- a/apps/web/src/native/plugins.ts+++ b/apps/web/src/native/plugins.ts@@ -71,6 +71,7 @@ export interface PushNotificationsPlugin {register(): Promise<void>unregister(): Promise<void>createChannel(channel: { id: string; name: string; importance?: number; visibility?: number }): Promise<void>+ deleteChannel(channel: { id: string }): Promise<void>addListener(event: 'registration', fn: (token: { value: string }) => void): Promise<Listener>addListener(event: 'registrationError', fn: (e: { error: string }) => void): Promise<Listener>addListener(diff --git a/apps/web/src/native/push.ts b/apps/web/src/native/push.tsindex 630defc3..ec56949c 100644--- a/apps/web/src/native/push.ts+++ b/apps/web/src/native/push.ts@@ -1,7 +1,7 @@// Push notifications in the Linedesk app (iOS: APNs, Android: FCM; apps/api/src/native-push.ts sends them). The phone's// permission, its device token (registered with push.registerDevice, endpoint `apns:<token>` / `fcm:<token>`), and a// tap on a notification opening its call. The web push of browsers (../push.ts) does the same with a service worker.-import { nativePushEndpoint } from '@linedesk/actions'+import { ANDROID_CALLS_CHANNEL, ANDROID_OLD_CALLS_CHANNEL, nativePushEndpoint } from '@linedesk/actions'import { readStored, writeStored } from '../safeStorage.ts'import { nativePlatform, type NativePlatform } from './platform.ts'import { PushNotifications } from './plugins.ts'@@ -39,21 +39,47 @@ export function nativeEndpointHere(): string | null {const REGISTER_WAIT_MS = 20_000+/** Android's lock-screen visibility of a channel: private shows that a notification came, not its text. */+const VISIBILITY_PRIVATE = 0++/**+ * Android's "Calls" channel (urgent calls make a sound and show on top; on the lock screen without who called or why),+ * and the older channel with the text on the lock screen goes. Making a channel that exists only updates its name.+ */+async function makeCallsChannel(callsChannelName: string) {+ if (nativePlatform() !== 'android') return+ await PushNotifications.createChannel({+ id: ANDROID_CALLS_CHANNEL,+ name: callsChannelName,+ importance: 5,+ visibility: VISIBILITY_PRIVATE,+ }).catch(() => {})+ await PushNotifications.deleteChannel({ id: ANDROID_OLD_CALLS_CHANNEL }).catch(() => {})+}++/**+ * At every start of the app, when the phone already allows notifications (never asks): the calls channel, so a phone+ * that had push on before keeps the sound and the pop-up of urgent calls.+ */+export async function prepareNativePush(callsChannelName: string): Promise<boolean> {+ if (!nativePlatform() || (await readNativePermission()) !== 'granted') return false+ await makeCallsChannel(callsChannelName)+ return true+}+/**- * Registers the phone with Apple or Google and resolves with its token for push.registerDevice. Android gets its- * "Calls" channel first (urgent calls make a sound and show on top).+ * Registers the phone with Apple or Google and resolves with its token for push.registerDevice; Android gets its calls+ * channel first. `ask: false` (registering again at a start): only when the phone already allows notifications.*/export async function registerNativePush(callsChannelName: string,+ { ask = true }: { ask?: boolean } = {},): Promise<{ platform: NativePlatform; token: string } | 'denied'> {const platform = nativePlatform()// i18n-ignore: never reached in a browser (the switch offers this only in the app)if (!platform) throw new Error('not in the app')- if ((await askNativePermission()) !== 'granted') return 'denied'- if (platform === 'android')- await PushNotifications.createChannel({ id: 'calls', name: callsChannelName, importance: 5, visibility: 1 }).catch(- () => {},- )+ if ((await (ask ? askNativePermission() : readNativePermission())) !== 'granted') return 'denied'+ await makeCallsChannel(callsChannelName)const token = await new Promise<string>((resolve, reject) => {// i18n-ignore: shown inside account.notify.pushFailed's {reason}, like the browser's own push errorsconst timer = setTimeout(() => reject(new Error('no answer from the push service')), REGISTER_WAIT_MS)diff --git a/apps/web/src/push.ts b/apps/web/src/push.tsindex a5640848..ac0ab8a5 100644--- a/apps/web/src/push.ts+++ b/apps/web/src/push.ts@@ -1,9 +1,9 @@// Web Push in the browser: subscribing this browser with the service worker (public/sw.js), knowing// whether it gets pushes in the open workspace, and ending its subscription on sign-out. The// subscription (endpoint and keys) only goes to the API (push.subscribe); it is never stored here.-import { pushDeviceId } from '@linedesk/actions'-import { isNativeApp } from './native/platform.ts'-import { nativeEndpointHere, onNativePushOpensCall, unregisterNativePush } from './native/push.ts'+import { type NotificationSettingsData, pushDeviceId } from '@linedesk/actions'+import { isNativeApp, nativePlatform } from './native/platform.ts'+import { nativeEndpointHere, onNativePushOpensCall, registerNativePush, unregisterNativePush } from './native/push.ts'import { serviceWorkerSupported } from './serviceWorker.ts'import { workspaceHeaders } from './tabWorkspace.ts'@@ -77,6 +77,41 @@ export async function subscribeThisBrowser(publicKey: string): Promise<PushInputconst SIGN_OUT_WAIT_MS = 3000+/** A push action sent at once, outside the outbox: nobody waits for it, and a failure shows nothing (tried again at the next start). */+const sendQuietly = (name: string, input: object) =>+ fetch(`/v1/actions/${name}`, {+ method: 'POST',+ credentials: 'include',+ headers: { ...workspaceHeaders(), 'content-type': 'application/json', 'idempotency-key': crypto.randomUUID() },+ body: JSON.stringify(input),+ }).catch(() => null)++/**+ * At every start, signed in, in the open workspace: a browser or phone that gets pushes here is registered again, so+ * its row belongs to this session (push_subscriptions.session_id: its pushes end with the session; a row from before+ * the column gets one). Never asks for permission and never turns push on: only a device the server lists here.+ * `settings`: fresh from the server (notifications.get).+ */+export async function refreshPushHere(settings: NotificationSettingsData, callsChannelName: string) {+ const id = await thisDeviceId().catch(() => null)+ if (!id || !settings.push.devices.includes(id)) return+ const platform = nativePlatform()+ if (platform) {+ if (!settings.push.native?.[platform]) return+ const device = await registerNativePush(callsChannelName, { ask: false }).catch(() => 'denied' as const)+ if (device !== 'denied') await sendQuietly('push.registerDevice', device)+ return+ }+ if (!settings.push.publicKey || !('Notification' in window) || Notification.permission !== 'granted') return+ const subscription = await currentSubscription().catch(() => null)+ if (!subscription) return+ const json = subscription.toJSON()+ await sendQuietly('push.subscribe', {+ endpoint: subscription.endpoint,+ keys: { p256dh: json.keys?.p256dh ?? '', auth: json.keys?.auth ?? '' },+ })+}+/*** On sign-out: the server forgets this browser in all of the member's workspaces (while the session* still exists), then the browser ends the subscription, so nothing reaches it any more even if thediff --git a/apps/web/src/shell/useCallNotifications.ts b/apps/web/src/shell/useCallNotifications.tsindex dcc40dd9..38936de0 100644--- a/apps/web/src/shell/useCallNotifications.ts+++ b/apps/web/src/shell/useCallNotifications.ts@@ -7,7 +7,8 @@ import type { NotificationSettingsData } from '@linedesk/actions'import type { Call } from '@linedesk/db/types'import { useEffect, useRef } from 'react'import { setQueryData, useQuery } from '../cachedQuery.ts'-import { onPushOpensCall, pushSupport, thisDeviceId } from '../push.ts'+import { onPushOpensCall, pushSupport, refreshPushHere, thisDeviceId } from '../push.ts'+import { tabWorkspace } from '../tabWorkspace.ts'import { readAction } from '../settings/settings-api.ts'import { useRows } from '../store.tsx'import { callHash } from './useRoute.ts'@@ -74,6 +75,19 @@ export async function notifiesHere(prefs: NotificationSettingsData): Promise<booreturn id !== null && prefs.push.devices.includes(id)}+/** The workspaces whose push device was registered again since this page loaded (once each). */+const refreshed = new Set<string>()++/** Once per start and workspace: this device's push registration again, with the current session (refreshPushHere). */+function refreshPushOnce() {+ const workspace = tabWorkspace()+ if (!workspace || refreshed.has(workspace)) return+ refreshed.add(workspace)+ void loadNotificationSettings()+ .then(settings => refreshPushHere(settings, i18n().t('account.notify.callsChannel')))+ .catch(() => {})+}+export function useCallNotifications(callerName: (call: Call) => string) {const calls = useRows('calls')const prefs = useNotificationSettings()@@ -82,6 +96,9 @@ export function useCallNotifications(callerName: (call: Call) => string) {const name = useRef(callerName)name.current = callerName+ // This device's push registration belongs to the session it is signed in with now.+ useEffect(refreshPushOnce)+// A click on a push notification (service worker) opens its call here.useEffect(() =>diff --git a/docs/architecture.md b/docs/architecture.mdindex cfd18b81..04abe58b 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -547,7 +547,7 @@ Design: [white-label.md](white-label.md) (decided 2026-11-17). A partner (`partn- **Provider sign-in.** Google refuses OAuth inside an app's web view, so in the app every provider sign-in (Google, Apple, Microsoft, GitHub, OIDC) runs in the system's sign-in browser: iOS `ASWebAuthenticationSession` (iOS 17.4, `.https` callback), Android Chrome Custom Tabs (`LinedeskAuthPlugin`, our own plugin in both projects; it opens only the app's own server). The session comes back like an OAuth code with PKCE, tied to a provider sign-in of that same flow (`apps/api/src/app-sign-in.ts`, a Better Auth plugin; security review of #1997): the app keeps a random verifier and opens `/app-sign-in?provider=…&challenge=<SHA-256 of it>`. That page posts the challenge to `POST /api/auth/app-sign-in/start` (kept with the time in a signed httpOnly cookie of that browser, 15 minutes) and signs in with the provider. Back from it, the page shows who signed in and asks for the person's OK; only then `POST /api/auth/app-sign-in/code` gives a one-use code (32 random bytes, stored hashed in `verification` with the user, the challenge and the browser's session; 2 minutes, one per start), and only for a session made after the start: a session the browser had before never counts, and an impersonation never. The code goes to the app on the server's own https address `/app-sign-in/back?code=…`, a universal link / verified app link that only the real app receives (no custom scheme another app could claim). The app's web view redeems it with the verifier (`POST /api/auth/app-sign-in/redeem`): the row is deleted in the same statement that reads it, a wrong verifier spends it, the browser's session must still exist (a password reset or "sign out everywhere" in between ends the hand-back) and is ended, the web view's own older session too, and the new session is made by Better Auth's adapter, so the session hooks run (disabled accounts, the host, the audit log with method `app`). All three endpoints check the origin like Better Auth's own sign-in endpoints (`formCsrfMiddleware`), so another site's form can neither start nor redeem. Everything the provider sign-in itself checks (address proof, sign-up gate, admin alerts) ran in the browser. Email codes, passwords and passkeys work inside the app's web view as on the web (passkeys through the app's associated domain).- **Links.** `GET /.well-known/apple-app-site-association` and `/.well-known/assetlinks.json` (`apps/api/src/app-links.ts`, from `MOBILE_IOS_APP_IDS` and `MOBILE_ANDROID_APP`; 404 without them) let links to the start page `/` (every email link: `/#call/…`, `/?invite=…`) and the sign-in hand-back `/app-sign-in/back` open the app; the app then shows that address (`appUrlOpen`, `native/init.ts`; the hand-back belongs to the waiting sign-in). Other paths (`/app-sign-in`, the API, Stripe's return) stay in the browser.-- **Push.** The app gets its pushes from Apple (APNs, token-based with the `.p8` key, `apps/api/src/native-push.ts`, over HTTP/2; production first, the sandbox for a build from Xcode) and Google (FCM HTTP v1, an access token from the service account), next to the browsers' Web Push and with the same payload and job (`push.ts`): who called and, for members who opted in, one line on what about; one notification per call (APNs `apns-collapse-id`, FCM `collapse_key` and tag), time-sensitive on iOS and the high-importance "Calls" channel on Android for urgent calls. Turning on notifications in the app asks the phone, registers it with Apple or Google and stores its token with `push.registerDevice` in `push_subscriptions` as the endpoint `apns:<token>` or `fcm:<token>` (no keys; the same row rules as a browser: per member and workspace, at most 10, a token of someone else's row is taken over, gone tokens are deleted when APNs or FCM say so, sign-out removes it). The keys are Server admin › Providers › Mobile app push (Apple Push Notifications: `.p8` key, key ID, team ID, bundle ID; Firebase Cloud Messaging: the service account JSON), read at each push; Test connection sends to a made-up device. Unlike Web Push (encrypted end to end, RFC 8291), Apple and Google can read the app's notifications: the caller's name or number and, for members who opted in, the summary line.+- **Push.** The app gets its pushes from Apple (APNs, token-based with the `.p8` key, `apps/api/src/native-push.ts`, over HTTP/2; production first, the sandbox for a build from Xcode) and Google (FCM HTTP v1, an access token from the service account), next to the browsers' Web Push and with the same payload and job (`push.ts`): who called and, for members who opted in, one line on what about; one notification per call (APNs `apns-collapse-id`, FCM `collapse_key` and tag), time-sensitive on iOS and the high-importance "Calls" channel on Android for urgent calls (channel `calls-v2`, private on the lock screen: only that a notification came, not who called or why). Turning on notifications in the app asks the phone, registers it with Apple or Google and stores its token with `push.registerDevice` in `push_subscriptions` as the endpoint `apns:<token>` or `fcm:<token>` (no keys; the same row rules as a browser: per member and workspace, at most 10, a token of someone else's row is taken over, gone tokens are deleted when APNs or FCM say so (FCM: only `UNREGISTERED`), sign-out removes it, and the row ends with the session that registered it: `push_subscriptions.session_id`, ON DELETE CASCADE, so a sign-out in Settings › Sessions, a password change or reset that ends the other sessions, or expiry stops its pushes too). The keys are Server admin › Providers › Mobile app push (Apple Push Notifications: `.p8` key, key ID, team ID, bundle ID; Firebase Cloud Messaging: the service account JSON), read at each push; Test connection sends to a made-up device. Unlike Web Push (encrypted end to end, RFC 8291), Apple and Google can read the app's notifications: the caller's name or number and, for members who opted in, the summary line.- **Phone.** Status bar, splash screen, the Android back button (closes what is open, then goes back, then puts the app in the background), the keyboard, safe areas (`viewport-fit=cover` inside the app).- **No buying in the apps.** The store rules (App Store 3.1.1 and 3.1.3(b), Google Play payments) allow a multiplatform service whose plans are bought elsewhere, without calls to action. Inside the app every purchase step is hidden: Settings › Billing, the billing banner, the trial link, the plan step of onboarding (a neutral "Your plan is managed on the web" step that waits for the plan), extra paid phone numbers, the partner's activation and billing, prices of call quality levels, and trial wording on the sign-up and sign-in pages.- **Account deletion** (App Store 5.1.1(v)): Account › Profile › Delete account opens Workspace settings › Danger zone, where leaving the last workspace or deleting an owned one deletes the account.diff --git a/packages/actions/src/notifications.ts b/packages/actions/src/notifications.tsindex d2cadf63..92bb3c49 100644--- a/packages/actions/src/notifications.ts+++ b/packages/actions/src/notifications.ts@@ -131,6 +131,15 @@ export const pushSubscribe = defineAction({const APNS_TOKEN = /^[0-9a-f]{64,200}$/iconst FCM_TOKEN = /^[A-Za-z0-9_:-]{20,4096}$/+/**+ * The Android notification channel of call pushes (the app makes it, FCM messages name it). Its lock-screen visibility+ * is private: the lock screen shows that a notification came, not who called or why. A channel's settings cannot be+ * changed once it exists, so the first one (`calls`, public on the lock screen) was replaced by this id (LIN-874).+ */+export const ANDROID_CALLS_CHANNEL = 'calls-v2'+/** The channel the app made before ANDROID_CALLS_CHANNEL; deleted on the phone when the new one is made. */+export const ANDROID_OLD_CALLS_CHANNEL = 'calls'+/** The endpoint a native device is stored under: `apns:<token>` (iOS) or `fcm:<token>` (Android). */export const nativePushEndpoint = (platform: 'ios' | 'android', token: string) =>platform === 'ios' ? `apns:${token.toLowerCase()}` : `fcm:${token}`diff --git a/packages/db/migrations/0193_push_subscription_session.sql b/packages/db/migrations/0193_push_subscription_session.sqlnew file mode 100644index 00000000..6f553dda--- /dev/null+++ b/packages/db/migrations/0193_push_subscription_session.sql@@ -0,0 +1,3 @@+ALTER TABLE "push_subscriptions" ADD COLUMN "session_id" text;--> statement-breakpoint+ALTER TABLE "push_subscriptions" ADD CONSTRAINT "push_subscriptions_session_id_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."session"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint+CREATE INDEX "push_subscriptions_session_idx" ON "push_subscriptions" USING btree ("session_id");\ No newline at end of filediff --git a/packages/db/migrations/meta/0193_snapshot.json b/packages/db/migrations/meta/0193_snapshot.jsonnew file mode 100644index 00000000..3831f652--- /dev/null+++ b/packages/db/migrations/meta/0193_snapshot.json@@ -0,0 +1,11472 @@+{+ "id": "968f3108-a4f5-43ac-8c90-07ac4453e2f9",+ "prevId": "d342d32e-e0ec-4ce7-bf86-5a6953bc9fdb",+ "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+ }+ },+ "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 b3d3e987..764e6dfd 100644--- a/packages/db/migrations/meta/_journal.json+++ b/packages/db/migrations/meta/_journal.json@@ -1345,6 +1345,13 @@"when": 1795891466991,"tag": "0192_outbound_retries","breakpoints": true+ },+ {+ "idx": 192,+ "version": "7",+ "when": 1796247335087,+ "tag": "0193_push_subscription_session",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema.ts b/packages/db/src/schema.tsindex 005f6e21..4302446f 100644--- a/packages/db/src/schema.ts+++ b/packages/db/src/schema.ts@@ -22,7 +22,7 @@ import {unique,uniqueIndex,} from 'drizzle-orm/pg-core'-import { organization, user } from './auth-schema.ts'+import { organization, session, user } from './auth-schema.ts'import {appErrorCodes,DEFAULT_TRANSFERS,@@ -677,7 +677,7 @@ export const member_notification_settings = pgTable(// Web Push: one row per browser (its push service endpoint) and workspace a member turned push on in.// Not synced. The endpoint and keys let anyone send to that browser, so they never leave the server// and are redacted in the command log. Rows go when the member signs out, leaves or is removed, is-// disabled, or when the push service says the subscription is gone.+// disabled, or when the push service says the subscription is gone; and with the session that turned it on (session_id).export const push_subscriptions = pgTable('push_subscriptions',{@@ -687,8 +687,20 @@ export const push_subscriptions = pgTable(p256dh: text('p256dh').notNull(),auth: text('auth').notNull(),created_at: createdAt(),+ /**+ * The sign-in that last registered this browser or app: when it ends (signed out in Settings › Sessions, a+ * password change or reset that ends the other sessions, expiry) the row goes with it, and until the expired row is+ * deleted no push goes to it (apps/api/src/push.ts liveSubscription). The app and the web app register a device+ * they already have again at every start, signed in, in the open workspace (apps/web/src/push.ts refreshPushHere).+ * null: a row from before this column, until that happens.+ */+ session_id: text('session_id').references(() => session.id, { onDelete: 'cascade' }),},- t => [primaryKey({ columns: [t.workspace_id, t.endpoint] }), index('push_subscriptions_user_idx').on(t.user_id)],+ t => [+ primaryKey({ columns: [t.workspace_id, t.endpoint] }),+ index('push_subscriptions_user_idx').on(t.user_id),+ index('push_subscriptions_session_idx').on(t.session_id),+ ],)// Weekly working hours: wall-clock times in the workspace time zone. Several rows per weekday are allowed.diff --git a/packages/i18n/locales/en/auth.json b/packages/i18n/locales/en/auth.jsonindex 3f972378..77d33b4e 100644--- a/packages/i18n/locales/en/auth.json+++ b/packages/i18n/locales/en/auth.json@@ -17,7 +17,7 @@"addPasskey.whyProvider": "Sign in with one touch next time, without {provider}.","addPasskey.whyUnnamedProvider": "Sign in with one touch next time.","appSignIn.back": "Back to the Linedesk app",- "appSignIn.confirm": "Sign in to the Linedesk app on this phone as {email}?",+ "appSignIn.confirm": "Continue only if you just tapped Sign in in the Linedesk app on this phone. The app is then signed in as {email}.","appSignIn.continue": "Continue","appSignIn.failed": "The sign-in did not work. Go back to the app and try again.","appSignIn.openApp": "Open the Linedesk app to finish signing in.",diff --git a/packages/i18n/locales/en/server.json b/packages/i18n/locales/en/server.jsonindex 33fd0823..fa5ba93b 100644--- a/packages/i18n/locales/en/server.json+++ b/packages/i18n/locales/en/server.json@@ -322,6 +322,7 @@"api.providerTest.twilio.unknownSid": "Twilio does not know this account SID (HTTP 404). Copy it from the Twilio Console.","api.providerTest.twilio.usedUp": "Twilio balance is used up ({amount}). Add funds in the Twilio Console.","api.push.appNotSetUp": "Push notifications for the app are not set up on this server.",+ "api.push.needsSession": "Turn on push notifications in a signed-in browser or in the Linedesk app.","api.setup.lookupsUsed": "You used the business lookups for setting up. Fill in the rest by hand, or start your free trial for more.","api.setup.testMinutesUsed": "You used the test-call minutes for setting up. Start your free trial to keep testing and to get your number.","api.shopifyApp.linkExpired": "This link has expired. Open the app in your Shopify admin again for a new one.",