diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index c274aa30748..909cd6d5c26 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -18,7 +18,7 @@ jobs: - name: Setup Node.js environment uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 cache: "pnpm" - name: Install dependencies diff --git a/.github/workflows/playwright.yaml b/.github/workflows/playwright.yaml index c342690c457..55cc01ce0bb 100644 --- a/.github/workflows/playwright.yaml +++ b/.github/workflows/playwright.yaml @@ -22,8 +22,7 @@ jobs: env: CI: "true" NODE_OPTIONS: "--max-old-space-size=8192" - DATABASE_URL: "mysql://root:@localhost:3306/planetscale" - PLANETSCALE_DATABASE_URL: "http://root:unused@localhost:3900/planetscale" + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/dub?schema=public" NEXTAUTH_SECRET: "e2e-test-secret-at-least-32-chars-long" NEXTAUTH_URL: "http://partners.localhost:8888" @@ -70,19 +69,19 @@ jobs: STRIPE_APP_SECRET_KEY: "xx" services: - mysql: - image: mysql:8.0 + postgres: + image: postgres:16 env: - MYSQL_DATABASE: planetscale - MYSQL_ROOT_HOST: "%" - MYSQL_ALLOW_EMPTY_PASSWORD: "yes" + POSTGRES_DB: dub + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres options: >- - --health-cmd="mysqladmin ping -h 127.0.0.1" + --health-cmd="pg_isready -U postgres -d dub" --health-interval=10s --health-timeout=5s --health-retries=5 ports: - - 3306:3306 + - 5432:5432 mailhog: image: mailhog/mailhog:latest @@ -113,24 +112,13 @@ jobs: - name: Check out code uses: actions/checkout@v4 - - name: Start PlanetScale simulator - run: | - docker run -d --name ps-http-sim \ - --network host \ - ghcr.io/mattrobenolt/ps-http-sim:latest \ - -listen-addr=0.0.0.0 \ - -listen-port=3900 \ - -mysql-dbname=planetscale \ - -mysql-no-pass \ - -mysql-addr=127.0.0.1 - - name: Setup pnpm uses: pnpm/action-setup@v3 - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 cache: "pnpm" - name: Install dependencies @@ -155,6 +143,10 @@ jobs: working-directory: apps/web run: pnpm prisma:push + - name: Apply PostgreSQL postdeploy SQL + working-directory: packages/prisma + run: pnpm postdeploy:postgres + - name: Seed test data working-directory: apps/web run: pnpm tsx playwright/seed.ts diff --git a/.gitignore b/.gitignore index 898bef49661..0069bba0acf 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ dist/ # typescript *.tsbuildinfo next-env.d.ts +packages/prisma/.tmp/ # miscellaneous apps/web/scripts/fix.ts @@ -50,4 +51,4 @@ packages/stripe-app/.build/* playwright-report/ **/playwright/.auth/ test-results/ -blob-report/ \ No newline at end of file +blob-report/ diff --git a/README.md b/README.md index f205b3427d3..23e999b4cf1 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Our platform powers 100M+ clicks and 2M+ links monthly, and is used by world-cla - [Prisma](https://www.prisma.io/) – ORM - [Upstash](https://upstash.com/) – redis - [Tinybird](https://tinybird.com/) – analytics -- [PlanetScale](https://planetscale.com/) – database +- [PostgreSQL](https://www.postgresql.org/) – database - [NextAuth.js](https://next-auth.js.org/) – auth - [BoxyHQ](https://boxyhq.com/enterprise-sso) – SSO/SAML - [Turborepo](https://turbo.build/repo) – monorepo diff --git a/apps/web/.env.example b/apps/web/.env.example index ac8c3dc3b3c..976c6ca2287 100644 --- a/apps/web/.env.example +++ b/apps/web/.env.example @@ -16,11 +16,10 @@ ENCRYPTION_KEY= # Email unsubscribe token secret (optional, falls back to NEXTAUTH_SECRET) UNSUBSCRIBE_TOKEN_SECRET= -# MySQL Database via Planetscale -# Get your MySQL Database URL here: https://planetscale.com/docs/tutorials/connect-nodejs-app -DATABASE_URL="mysql://root:@localhost:3306/planetscale" -# Set local development documentation for connecting to a local database: https://dub.co/docs/local-development#step-4-set-up-planetscale-mysql-database -PLANETSCALE_DATABASE_URL="http://root:unused@localhost:3900/planetscale" +# PostgreSQL Database +DATABASE_URL="postgresql://postgres:postgres@localhost:5432/dub?schema=public" +# Optional webhook to trigger an external PostgreSQL backup job from the backup cron route +POSTGRES_BACKUP_WEBHOOK_URL= # Upstash Redis – required for Redis caching # Get your Redis REST URL and Token here: https://upstash.com/docs/redis/overall/getstarted @@ -172,9 +171,6 @@ PAYPAL_WEBHOOK_ID= # Program lander generation FIRECRAWL_API_KEY= -# for generating planetscale backups (https://planetscale.com/docs/api/service-tokens) -PLANETSCALE_SERVICE_TOKEN= - # Hubspot HUBSPOT_CLIENT_ID= HUBSPOT_CLIENT_SECRET= diff --git a/apps/web/app/(ee)/api/admin/commissions/get-commissions-timeseries.ts b/apps/web/app/(ee)/api/admin/commissions/get-commissions-timeseries.ts index 1c70ad288b2..7b481254fa9 100644 --- a/apps/web/app/(ee)/api/admin/commissions/get-commissions-timeseries.ts +++ b/apps/web/app/(ee)/api/admin/commissions/get-commissions-timeseries.ts @@ -1,4 +1,7 @@ -import { sqlGranularityMap } from "@/lib/planetscale/granularity"; +import { + pgDateBucket, + sqlGranularityMap, +} from "@/lib/postgres/granularity"; import { TZDate } from "@date-fns/tz"; import { prisma } from "@dub/prisma"; import { Prisma } from "@dub/prisma/client"; @@ -27,15 +30,15 @@ export async function getCommissionsTimeseries({ sqlGranularityMap[granularity]; const commissions = await prisma.$queryRaw` - SELECT - DATE_FORMAT(CONVERT_TZ(createdAt, "UTC", ${timezone || "UTC"}), ${dateFormat}) AS start, + SELECT + ${pgDateBucket({ column: Prisma.sql`"createdAt"`, timezone: timezone || "UTC", dateFormat })} AS start, SUM(earnings) AS commissions - FROM Commission - WHERE - createdAt >= ${startDate} - AND createdAt < ${endDate} - AND status IN ("pending", "processed", "paid") - AND ${programId ? Prisma.sql`programId = ${programId}` : Prisma.sql`programId != ${ACME_PROGRAM_ID}`} + FROM "Commission" + WHERE + "createdAt" >= ${startDate} + AND "createdAt" < ${endDate} + AND status IN ('pending', 'processed', 'paid') + AND ${programId ? Prisma.sql`"programId" = ${programId}` : Prisma.sql`"programId" != ${ACME_PROGRAM_ID}`} GROUP BY start ORDER BY start ASC;`; diff --git a/apps/web/app/(ee)/api/admin/partners/delete-account/route.ts b/apps/web/app/(ee)/api/admin/partners/delete-account/route.ts index 15e35c43de0..3373e52dbc0 100644 --- a/apps/web/app/(ee)/api/admin/partners/delete-account/route.ts +++ b/apps/web/app/(ee)/api/admin/partners/delete-account/route.ts @@ -1,5 +1,5 @@ import { withAdmin } from "@/lib/auth"; -import { conn } from "@/lib/planetscale"; +import { conn } from "@/lib/postgres"; import { stripe } from "@/lib/stripe"; import { recordLink } from "@/lib/tinybird"; import { prisma } from "@dub/prisma"; @@ -142,7 +142,7 @@ export const POST = withAdmin( ); } - await conn.execute(`DELETE FROM Partner WHERE id = ?`, [partner.id]); + await conn.execute(`DELETE FROM "Partner" WHERE id = ?`, [partner.id]); console.log(`Deleted partner ${partner.email} (${partner.id})`); } diff --git a/apps/web/app/(ee)/api/admin/payouts/route.ts b/apps/web/app/(ee)/api/admin/payouts/route.ts index 848a6930ddb..8ed647b0369 100644 --- a/apps/web/app/(ee)/api/admin/payouts/route.ts +++ b/apps/web/app/(ee)/api/admin/payouts/route.ts @@ -1,6 +1,9 @@ import { getStartEndDates } from "@/lib/analytics/utils/get-start-end-dates"; import { withAdmin } from "@/lib/auth"; -import { sqlGranularityMap } from "@/lib/planetscale/granularity"; +import { + pgDateBucket, + sqlGranularityMap, +} from "@/lib/postgres/granularity"; import { analyticsQuerySchema } from "@/lib/zod/schemas/analytics"; import { prisma } from "@dub/prisma"; import { InvoiceStatus, Prisma } from "@dub/prisma/client"; @@ -93,17 +96,17 @@ export const GET = withAdmin(async ({ searchParams }) => { { date: Date; payouts: number; fees: number; total: number }[] >` SELECT - DATE_FORMAT(CONVERT_TZ(createdAt, "UTC", ${timezone}), ${dateFormat}) as date, + ${pgDateBucket({ column: Prisma.sql`"createdAt"`, timezone, dateFormat })} as date, SUM(amount) as payouts, SUM(fee) as fees, SUM(total) as total - FROM Invoice + FROM "Invoice" WHERE - ${programId ? Prisma.sql`programId = ${programId}` : Prisma.sql`programId != ${ACME_PROGRAM_ID}`} + ${programId ? Prisma.sql`"programId" = ${programId}` : Prisma.sql`"programId" != ${ACME_PROGRAM_ID}`} AND ${status ? Prisma.sql`status = ${status}` : Prisma.sql`status != 'failed'`} - AND createdAt >= ${startDate} - AND createdAt <= ${endDate} - GROUP BY DATE_FORMAT(CONVERT_TZ(createdAt, "UTC", ${timezone}), ${dateFormat}) + AND "createdAt" >= ${startDate} + AND "createdAt" <= ${endDate} + GROUP BY date ORDER BY date ASC; `; diff --git a/apps/web/app/(ee)/api/appsflyer/webhook/route.ts b/apps/web/app/(ee)/api/appsflyer/webhook/route.ts index ac71e44917f..eda1fc30a9a 100644 --- a/apps/web/app/(ee)/api/appsflyer/webhook/route.ts +++ b/apps/web/app/(ee)/api/appsflyer/webhook/route.ts @@ -61,7 +61,7 @@ export const GET = withAxiom(async (req) => { where: { integrationId: APPSFLYER_INTEGRATION_ID, settings: { - path: "$.appIds", + path: ["appIds"], array_contains: appId, }, }, diff --git a/apps/web/app/(ee)/api/commissions/analytics/route.ts b/apps/web/app/(ee)/api/commissions/analytics/route.ts index f3bd98a037c..aee68071d9f 100644 --- a/apps/web/app/(ee)/api/commissions/analytics/route.ts +++ b/apps/web/app/(ee)/api/commissions/analytics/route.ts @@ -6,7 +6,10 @@ import { commissionAnalyticsQuerySchema, commissionAnalyticsSchema, } from "@/lib/commissions/schema"; -import { sqlGranularityMap } from "@/lib/planetscale/granularity"; +import { + pgDateBucket, + sqlGranularityMap, +} from "@/lib/postgres/granularity"; import type { CommissionAnalyticsQuery } from "@/lib/types"; import { prisma } from "@dub/prisma"; import { CommissionStatus, CommissionType, Prisma } from "@dub/prisma/client"; @@ -59,9 +62,9 @@ function commissionSqlConditions({ partnerTagIdParam: string | undefined; }): Prisma.Sql[] { const conditions: Prisma.Sql[] = [ - Prisma.sql`c.programId = ${programId}`, - Prisma.sql`c.createdAt >= ${startDate}`, - Prisma.sql`c.createdAt < ${endDate}`, + Prisma.sql`c."programId" = ${programId}`, + Prisma.sql`c."createdAt" >= ${startDate}`, + Prisma.sql`c."createdAt" < ${endDate}`, status ? Prisma.sql`c.status = ${status}` : Prisma.sql`c.status NOT IN (${Prisma.join([...excludedStatuses])})`, @@ -71,8 +74,8 @@ function commissionSqlConditions({ const list = Prisma.join(partnerFilter.values.map((v) => Prisma.sql`${v}`)); conditions.push( partnerFilter.sqlOperator === "NOT IN" - ? Prisma.sql`c.partnerId NOT IN (${list})` - : Prisma.sql`c.partnerId IN (${list})`, + ? Prisma.sql`c."partnerId" NOT IN (${list})` + : Prisma.sql`c."partnerId" IN (${list})`, ); } @@ -94,10 +97,10 @@ function commissionSqlConditions({ ? Prisma.sql`NOT IN` : Prisma.sql`IN`; conditions.push(Prisma.sql`EXISTS ( - SELECT 1 FROM ProgramEnrollment pe - WHERE pe.programId = c.programId - AND pe.partnerId = c.partnerId - AND pe.groupId ${op} (${list}) + SELECT 1 FROM "ProgramEnrollment" pe + WHERE pe."programId" = c."programId" + AND pe."partnerId" = c."partnerId" + AND pe."groupId" ${op} (${list}) )`); } } @@ -312,15 +315,15 @@ async function byGroupId({ const rows = await prisma.$queryRaw( Prisma.sql` SELECT - pe.groupId AS groupId, + pe."groupId" AS "groupId", SUM(c.earnings) AS earnings, COUNT(c.id) AS count - FROM Commission c - JOIN ProgramEnrollment pe - ON pe.programId = c.programId - AND pe.partnerId = c.partnerId + FROM "Commission" c + JOIN "ProgramEnrollment" pe + ON pe."programId" = c."programId" + AND pe."partnerId" = c."partnerId" WHERE ${whereClause} - GROUP BY pe.groupId + GROUP BY pe."groupId" ORDER BY earnings DESC`, ); @@ -631,10 +634,10 @@ async function byTimeseries({ const rows = await prisma.$queryRaw( Prisma.sql` SELECT - DATE_FORMAT(CONVERT_TZ(c.createdAt, "UTC", ${timezone || "UTC"}), ${dateFormat}) AS start, + ${pgDateBucket({ column: Prisma.sql`c."createdAt"`, timezone: timezone || "UTC", dateFormat })} AS start, SUM(c.earnings) AS earnings, COUNT(c.id) AS count - FROM Commission c + FROM "Commission" c WHERE ${whereClause} GROUP BY start ORDER BY start ASC`, diff --git a/apps/web/app/(ee)/api/cron/bounties/queue-sync-social-metrics/route.ts b/apps/web/app/(ee)/api/cron/bounties/queue-sync-social-metrics/route.ts index 7a753cb32a6..0877681ff19 100644 --- a/apps/web/app/(ee)/api/cron/bounties/queue-sync-social-metrics/route.ts +++ b/apps/web/app/(ee)/api/cron/bounties/queue-sync-social-metrics/route.ts @@ -28,7 +28,7 @@ export const GET = withCron(async () => { }, ], submissionRequirements: { - path: "$.socialMetrics", + path: ["socialMetrics"], not: Prisma.JsonNull, }, }, diff --git a/apps/web/app/(ee)/api/cron/domains/delete/route.ts b/apps/web/app/(ee)/api/cron/domains/delete/route.ts index 0831f2ab482..1b6861badfd 100644 --- a/apps/web/app/(ee)/api/cron/domains/delete/route.ts +++ b/apps/web/app/(ee)/api/cron/domains/delete/route.ts @@ -71,7 +71,7 @@ export async function POST(req: Request) { ), ), - // Remove the link from MySQL + // Remove the link from Postgres prisma.link.deleteMany({ where: { id: { in: links.map((link) => link.id) }, diff --git a/apps/web/app/(ee)/api/cron/network/calculate-program-similarities/calculate-partner-similarity.ts b/apps/web/app/(ee)/api/cron/network/calculate-program-similarities/calculate-partner-similarity.ts index 0e3afbdfeae..2389b39576c 100644 --- a/apps/web/app/(ee)/api/cron/network/calculate-program-similarities/calculate-partner-similarity.ts +++ b/apps/web/app/(ee)/api/cron/network/calculate-program-similarities/calculate-partner-similarity.ts @@ -13,15 +13,15 @@ export async function calculatePartnerSimilarity( ): Promise { const [result] = await prisma.$queryRaw` SELECT - COUNT(DISTINCT CASE WHEN e1.partnerId IS NOT NULL AND e2.partnerId IS NOT NULL THEN e1.partnerId END) AS sharedPartnersCount, - (SELECT COUNT(*) FROM ProgramEnrollment WHERE programId = ${program1Id}) AS program1PartnersCount, - (SELECT COUNT(*) FROM ProgramEnrollment WHERE programId = ${program2Id}) AS program2PartnersCount + COUNT(DISTINCT CASE WHEN e1."partnerId" IS NOT NULL AND e2."partnerId" IS NOT NULL THEN e1."partnerId" END) AS "sharedPartnersCount", + (SELECT COUNT(*) FROM "ProgramEnrollment" WHERE "programId" = ${program1Id}) AS "program1PartnersCount", + (SELECT COUNT(*) FROM "ProgramEnrollment" WHERE "programId" = ${program2Id}) AS "program2PartnersCount" FROM - ProgramEnrollment e1 + "ProgramEnrollment" e1 JOIN - ProgramEnrollment e2 ON e1.partnerId = e2.partnerId + "ProgramEnrollment" e2 ON e1."partnerId" = e2."partnerId" WHERE - e1.programId = ${program1Id} AND e2.programId = ${program2Id} + e1."programId" = ${program1Id} AND e2."programId" = ${program2Id} `; const { sharedPartnersCount, program1PartnersCount, program2PartnersCount } = diff --git a/apps/web/app/(ee)/api/cron/partner-program-summary/process/route.ts b/apps/web/app/(ee)/api/cron/partner-program-summary/process/route.ts index 53ac1b0ee11..c39011a526d 100644 --- a/apps/web/app/(ee)/api/cron/partner-program-summary/process/route.ts +++ b/apps/web/app/(ee)/api/cron/partner-program-summary/process/route.ts @@ -241,7 +241,7 @@ export const POST = withCron(async ({ rawBody }) => { const _previousMonthAnalytics = previousAnalyticsMap.get(partner.id); const _currentMonthAnalytics = currentAnalyticsMap.get(partner.id); - // Get lifetime analytics from MySQL + // Get lifetime analytics from Postgres const _lifetimeAnalytics = programEnrollments .find((enrollment) => enrollment.partner.id === partner.id) ?.links.reduce( @@ -253,7 +253,7 @@ export const POST = withCron(async ({ rawBody }) => { { clicks: 0, leads: 0, sales: 0 }, ); - // Get earnings data from MySQL + // Get earnings data from Postgres const _previousMonthEarnings = previousEarningsMap.get(partner.id); const _currentMonthEarnings = currentEarningsMap.get(partner.id); const _lifetimeEarnings = lifetimeEarningsMap.get(partner.id); diff --git a/apps/web/app/(ee)/api/cron/partners/merge-accounts/route.ts b/apps/web/app/(ee)/api/cron/partners/merge-accounts/route.ts index f268ad0f645..81009619597 100644 --- a/apps/web/app/(ee)/api/cron/partners/merge-accounts/route.ts +++ b/apps/web/app/(ee)/api/cron/partners/merge-accounts/route.ts @@ -5,7 +5,7 @@ import { includeProgramEnrollment } from "@/lib/api/links/include-program-enroll import { includeTags } from "@/lib/api/links/include-tags"; import { syncTotalCommissions } from "@/lib/api/partners/sync-total-commissions"; import { verifyQstashSignature } from "@/lib/cron/verify-qstash"; -import { conn } from "@/lib/planetscale"; +import { conn } from "@/lib/postgres"; import { storage } from "@/lib/storage"; import { recordLink } from "@/lib/tinybird"; import { redis } from "@/lib/upstash"; @@ -420,7 +420,9 @@ export async function POST(req: Request) { try { // Finally, delete the partner account - await conn.execute(`DELETE FROM Partner WHERE id = ?`, [sourcePartnerId]); + await conn.execute(`DELETE FROM "Partner" WHERE id = ?`, [ + sourcePartnerId, + ]); console.log( `Deleted partner ${sourceAccount.email} (${sourceAccount.id})`, ); diff --git a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts index 3c0cda2ae3d..8c944bc5d84 100644 --- a/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts +++ b/apps/web/app/(ee)/api/cron/payouts/charge-succeeded/route.ts @@ -60,11 +60,12 @@ export async function POST(req: Request) { // Set the method for each payout in the invoice to the corresponding partner's default payout method await prisma.$executeRaw` - UPDATE Payout p - INNER JOIN Partner pn ON p.partnerId = pn.id - SET p.method = pn.defaultPayoutMethod - WHERE p.invoiceId = ${invoice.id} - AND pn.defaultPayoutMethod IS NOT NULL + UPDATE "Payout" p + SET method = pn."defaultPayoutMethod" + FROM "Partner" pn + WHERE p."partnerId" = pn.id + AND p."invoiceId" = ${invoice.id} + AND pn."defaultPayoutMethod" IS NOT NULL AND p.status = 'processing' `; diff --git a/apps/web/app/(ee)/api/cron/pending-applications-summary/route.ts b/apps/web/app/(ee)/api/cron/pending-applications-summary/route.ts index 416958fc296..44d77f2668a 100644 --- a/apps/web/app/(ee)/api/cron/pending-applications-summary/route.ts +++ b/apps/web/app/(ee)/api/cron/pending-applications-summary/route.ts @@ -79,25 +79,25 @@ export const GET = withCron(async ({ rawBody }) => { }> >(Prisma.sql` SELECT - pe.programId, - p.id as partnerId, - p.name as partnerName, - p.email as partnerEmail, - p.image as partnerImage + pe."programId", + p.id as "partnerId", + p.name as "partnerName", + p.email as "partnerEmail", + p.image as "partnerImage" FROM ( SELECT id, - programId, - partnerId, - ROW_NUMBER() OVER (PARTITION BY programId ORDER BY createdAt DESC) as rn - FROM ProgramEnrollment - WHERE programId IN (${Prisma.join(programIds)}) + "programId", + "partnerId", + ROW_NUMBER() OVER (PARTITION BY "programId" ORDER BY "createdAt" DESC) as rn + FROM "ProgramEnrollment" + WHERE "programId" IN (${Prisma.join(programIds)}) AND status = 'pending' ) ranked - INNER JOIN ProgramEnrollment pe ON pe.id = ranked.id - INNER JOIN Partner p ON p.id = pe.partnerId + INNER JOIN "ProgramEnrollment" pe ON pe.id = ranked.id + INNER JOIN "Partner" p ON p.id = pe."partnerId" WHERE ranked.rn <= 3 - ORDER BY pe.programId, pe.createdAt DESC + ORDER BY pe."programId", pe."createdAt" DESC `); // Group enrollments by programId diff --git a/apps/web/app/(ee)/api/cron/sitemaps/queue/route.ts b/apps/web/app/(ee)/api/cron/sitemaps/queue/route.ts index f810471fe83..f514306425c 100644 --- a/apps/web/app/(ee)/api/cron/sitemaps/queue/route.ts +++ b/apps/web/app/(ee)/api/cron/sitemaps/queue/route.ts @@ -22,12 +22,13 @@ async function runSitemapQueueBatch(startingAfter?: string) { const rows = await prisma.$queryRaw>( Prisma.sql` SELECT p.id - FROM Project p - INNER JOIN Domain d ON d.projectId = p.id - AND d.slug = JSON_UNQUOTE(JSON_EXTRACT(p.siteVisitTrackingSettings, '$.siteDomainSlug')) - WHERE p.siteVisitTrackingSettings IS NOT NULL - AND JSON_LENGTH(JSON_EXTRACT(p.siteVisitTrackingSettings, '$.trackedSitemaps')) > 0 - AND CHAR_LENGTH(TRIM(IFNULL(JSON_UNQUOTE(JSON_EXTRACT(p.siteVisitTrackingSettings, '$.siteDomainSlug')), ''))) > 0 + FROM "Project" p + INNER JOIN "Domain" d ON d."projectId" = p.id + AND d.slug = p."siteVisitTrackingSettings"->>'siteDomainSlug' + WHERE p."siteVisitTrackingSettings" IS NOT NULL + AND jsonb_typeof(p."siteVisitTrackingSettings"->'trackedSitemaps') = 'array' + AND jsonb_array_length(p."siteVisitTrackingSettings"->'trackedSitemaps') > 0 + AND char_length(trim(coalesce(p."siteVisitTrackingSettings"->>'siteDomainSlug', ''))) > 0 ${cursorFragment} ORDER BY p.id ASC LIMIT ${SITEMAP_QUEUE_BATCH_SIZE} diff --git a/apps/web/app/(ee)/api/cron/streams/update-partner-stats/route.ts b/apps/web/app/(ee)/api/cron/streams/update-partner-stats/route.ts index 552d6378cc3..18f54db2315 100644 --- a/apps/web/app/(ee)/api/cron/streams/update-partner-stats/route.ts +++ b/apps/web/app/(ee)/api/cron/streams/update-partner-stats/route.ts @@ -1,6 +1,6 @@ import { handleAndReturnErrorResponse } from "@/lib/api/errors"; import { verifyVercelSignature } from "@/lib/cron/verify-vercel"; -import { conn } from "@/lib/planetscale"; +import { conn } from "@/lib/postgres"; import { PartnerActivityEvent, partnerActivityStream, @@ -286,9 +286,9 @@ const processPartnerActivityStreamBatch = () => // Update program enrollment stats if (finalStatsToUpdate.length > 0) { await conn.execute( - `UPDATE ProgramEnrollment SET ${finalStatsToUpdate - .map(([key, _]) => `${key} = ?`) - .join(", ")} WHERE programId = ? AND partnerId = ?`, + `UPDATE "ProgramEnrollment" SET ${finalStatsToUpdate + .map(([key, _]) => `"${key}" = ?`) + .join(", ")} WHERE "programId" = ? AND "partnerId" = ?`, [ ...finalStatsToUpdate.map(([_, value]) => value instanceof Date diff --git a/apps/web/app/(ee)/api/cron/streams/update-workspace-clicks/route.ts b/apps/web/app/(ee)/api/cron/streams/update-workspace-clicks/route.ts index 0ddc6fcf11c..97dee0d0904 100644 --- a/apps/web/app/(ee)/api/cron/streams/update-workspace-clicks/route.ts +++ b/apps/web/app/(ee)/api/cron/streams/update-workspace-clicks/route.ts @@ -1,6 +1,6 @@ import { handleAndReturnErrorResponse } from "@/lib/api/errors"; import { verifyVercelSignature } from "@/lib/cron/verify-vercel"; -import { conn } from "@/lib/planetscale"; +import { conn } from "@/lib/postgres"; import { RedisStreamEntry } from "@/lib/upstash/redis-streams/client"; import { WorkspaceClicksUsageEvent, @@ -108,7 +108,9 @@ const processWorkspaceUpdateStreamBatch = () => try { // Update the workspace usage and click counts await conn.execute( - "UPDATE Project p SET p.usage = p.usage + ?, p.totalClicks = p.totalClicks + ? WHERE id = ?", + `UPDATE "Project" + SET usage = usage + ?, "totalClicks" = "totalClicks" + ? + WHERE id = ?`, [update.clicks, update.clicks, update.workspaceId], ); diff --git a/apps/web/app/(ee)/api/cron/trigger-backup/route.ts b/apps/web/app/(ee)/api/cron/trigger-backup/route.ts index ebcc409d6bb..dffafed6c23 100644 --- a/apps/web/app/(ee)/api/cron/trigger-backup/route.ts +++ b/apps/web/app/(ee)/api/cron/trigger-backup/route.ts @@ -4,52 +4,32 @@ import { logAndRespond } from "../utils"; export const dynamic = "force-dynamic"; -// Creates a PlanetScale branch backup +// PostgreSQL backups are managed by the database provider. // Scheduled UTC: 12:40 AM, 8:40 AM, 12:40 PM, 8:40 PM (cron: 40 0,8,12,20 * * *) export async function GET(req: Request) { try { await verifyVercelSignature(req); - const tokenSecret = process.env.PLANETSCALE_SERVICE_TOKEN; - - if (!tokenSecret) { - throw new DubApiError({ - code: "internal_server_error", - message: "Missing PLANETSCALE_SERVICE_TOKEN", + if (process.env.POSTGRES_BACKUP_WEBHOOK_URL) { + const res = await fetch(process.env.POSTGRES_BACKUP_WEBHOOK_URL, { + method: "POST", }); - } - const res = await fetch( - `https://api.planetscale.com/v1/organizations/dub/databases/dub/branches/main/backups`, - { - method: "POST", - headers: { - Authorization: `jynn53mcug4l:${tokenSecret}`, - "Content-Type": "application/json", - }, - body: JSON.stringify({ - name: `cron-backup-${new Date().toISOString()}`, - retention_value: 7, - retention_unit: "day", - }), - }, - ); + if (!res.ok) { + const bodyText = await res.text(); - const bodyText = await res.text(); + throw new DubApiError({ + code: "internal_server_error", + message: `PostgreSQL backup webhook failed (${res.status}): ${bodyText}`, + }); + } - if (!res.ok) { - throw new DubApiError({ - code: "internal_server_error", - message: `PlanetScale backup failed (${res.status}): ${bodyText}`, - }); + return logAndRespond("Triggered PostgreSQL backup webhook."); } - const backup = JSON.parse(bodyText); - console.log({ backup }); - return logAndRespond( - `Created PlanetScale backup: ${backup.id} (${backup.name}) state=${backup.state}`, + "PostgreSQL backups are managed externally; no backup webhook configured.", ); } catch (error) { return handleAndReturnErrorResponse(error); diff --git a/apps/web/app/(ee)/api/hubspot/webhook/process/route.ts b/apps/web/app/(ee)/api/hubspot/webhook/process/route.ts index b55bff9a0c8..2f3bca39c92 100644 --- a/apps/web/app/(ee)/api/hubspot/webhook/process/route.ts +++ b/apps/web/app/(ee)/api/hubspot/webhook/process/route.ts @@ -42,7 +42,7 @@ export const POST = withAxiom(async (req) => { slug: "hubspot", }, credentials: { - path: "$.hub_id", + path: ["hub_id"], equals: portalId, }, }, diff --git a/apps/web/app/(ee)/api/network/programs/count/route.ts b/apps/web/app/(ee)/api/network/programs/count/route.ts index 4b602bb1f55..53d1ba64b43 100644 --- a/apps/web/app/(ee)/api/network/programs/count/route.ts +++ b/apps/web/app/(ee)/api/network/programs/count/route.ts @@ -6,10 +6,10 @@ import { Prisma } from "@dub/prisma/client"; import { NextResponse } from "next/server"; const rewardTypeMap = { - sale: Prisma.sql`pg.saleRewardId IS NOT NULL`, - lead: Prisma.sql`pg.leadRewardId IS NOT NULL`, - click: Prisma.sql`pg.clickRewardId IS NOT NULL`, - discount: Prisma.sql`pg.discountId IS NOT NULL`, + sale: Prisma.sql`pg."saleRewardId" IS NOT NULL`, + lead: Prisma.sql`pg."leadRewardId" IS NOT NULL`, + click: Prisma.sql`pg."clickRewardId" IS NOT NULL`, + discount: Prisma.sql`pg."discountId" IS NOT NULL`, }; // GET /api/network/programs/count - get the number of available programs in the network @@ -19,13 +19,13 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => { const searchSql = search ? Prisma.sql`CONCAT('%', ${search}, '%')` : null; const commonWhereSql = Prisma.sql` - p.addedToMarketplaceAt IS NOT NULL + p."addedToMarketplaceAt" IS NOT NULL AND EXISTS ( - SELECT 1 FROM PartnerGroup pg + SELECT 1 FROM "PartnerGroup" pg WHERE - pg.programId = p.id + pg."programId" = p.id AND pg.slug = ${DEFAULT_PARTNER_GROUP.slug} - AND pg.applicationFormPublishedAt IS NOT NULL + AND pg."applicationFormPublishedAt" IS NOT NULL ${ rewardType && groupBy !== "rewardType" ? Prisma.sql` @@ -37,8 +37,8 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => { category && groupBy !== "category" ? Prisma.sql` AND EXISTS ( - SELECT 1 FROM ProgramCategory pc - WHERE pc.programId = p.id AND pc.category = ${category} + SELECT 1 FROM "ProgramCategory" pc + WHERE pc."programId" = p.id AND pc.category = ${category} )` : Prisma.sql`` } @@ -46,23 +46,23 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => { status !== undefined && groupBy !== "status" ? Prisma.sql` AND ${status === null ? Prisma.sql`NOT` : Prisma.sql``} EXISTS ( - SELECT 1 FROM ProgramEnrollment pe + SELECT 1 FROM "ProgramEnrollment" pe WHERE - pe.programId = p.id - AND pe.partnerId = ${partner.id} + pe."programId" = p.id + AND pe."partnerId" = ${partner.id} ${status === null ? Prisma.sql`` : Prisma.sql`AND pe.status = ${status}`} )` : Prisma.sql`` } - ${featured !== undefined ? Prisma.sql`AND p.featuredOnMarketplaceAt IS ${featured ? Prisma.sql`NOT` : Prisma.sql``} NULL` : Prisma.sql``} - ${searchSql ? Prisma.sql`AND (p.name LIKE ${searchSql} OR p.slug LIKE ${searchSql} OR p.domain LIKE ${searchSql})` : Prisma.sql``} + ${featured !== undefined ? Prisma.sql`AND p."featuredOnMarketplaceAt" IS ${featured ? Prisma.sql`NOT` : Prisma.sql``} NULL` : Prisma.sql``} + ${searchSql ? Prisma.sql`AND (p.name ILIKE ${searchSql} OR p.slug ILIKE ${searchSql} OR p.domain ILIKE ${searchSql})` : Prisma.sql``} `; if (groupBy === "category") { const categories = (await prisma.$queryRaw` SELECT pc.category, COUNT(p.id) AS _count - FROM ProgramCategory pc - JOIN Program p ON p.id = pc.programId + FROM "ProgramCategory" pc + JOIN "Program" p ON p.id = pc."programId" WHERE ${commonWhereSql} GROUP BY pc.category ORDER BY _count DESC @@ -77,12 +77,12 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => { } else if (groupBy === "rewardType") { const rewards = (await prisma.$queryRaw` SELECT - COUNT(pg.clickRewardId) AS "click", - COUNT(pg.leadRewardId) AS "lead", - COUNT(pg.saleRewardId) AS "sale", - COUNT(discountId) AS "discount" - FROM PartnerGroup pg - JOIN Program p ON p.id = pg.programId + COUNT(pg."clickRewardId") AS "click", + COUNT(pg."leadRewardId") AS "lead", + COUNT(pg."saleRewardId") AS "sale", + COUNT(pg."discountId") AS "discount" + FROM "PartnerGroup" pg + JOIN "Program" p ON p.id = pg."programId" WHERE pg.slug = ${DEFAULT_PARTNER_GROUP.slug} AND ${commonWhereSql} `) as { click: bigint; lead: bigint; sale: bigint; discount: bigint }[]; @@ -95,9 +95,9 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => { } else if (groupBy === "status") { const statuses = (await prisma.$queryRaw` SELECT pe.status, COUNT(p.id) AS _count - FROM Program p - LEFT JOIN ProgramEnrollment pe ON p.id = pe.programId AND pe.partnerId = ${partner.id} - WHERE p.addedToMarketplaceAt IS NOT NULL AND ${commonWhereSql} + FROM "Program" p + LEFT JOIN "ProgramEnrollment" pe ON p.id = pe."programId" AND pe."partnerId" = ${partner.id} + WHERE p."addedToMarketplaceAt" IS NOT NULL AND ${commonWhereSql} GROUP BY pe.status ORDER BY _count DESC `) as { status: string | null; _count: bigint }[]; @@ -111,7 +111,7 @@ export const GET = withPartnerProfile(async ({ partner, searchParams }) => { } const count = (await prisma.$queryRaw` - SELECT COUNT(*) AS count FROM Program p + SELECT COUNT(*) AS count FROM "Program" p WHERE ${commonWhereSql} `) as { count: bigint }[]; diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/count/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/count/route.ts index 7a9160e81b9..5ad6e295f09 100644 --- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/count/route.ts +++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/count/route.ts @@ -57,8 +57,20 @@ export const GET = withPartnerProfile( ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), }; diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts index 972dc2be0dc..a1c5de3bf78 100644 --- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts +++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/route.ts @@ -65,8 +65,20 @@ export const GET = withPartnerProfile( ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), }, diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/count/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/count/route.ts index 430cd5a8924..5d1e1cce6ea 100644 --- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/count/route.ts +++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/count/route.ts @@ -31,8 +31,20 @@ export const GET = withPartnerProfile( ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), }; diff --git a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/route.ts b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/route.ts index 58d9d94f0cb..dabf2f90808 100644 --- a/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/route.ts +++ b/apps/web/app/(ee)/api/partner-profile/programs/[programId]/submitted-leads/route.ts @@ -36,8 +36,20 @@ export const GET = withPartnerProfile( ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), }, diff --git a/apps/web/app/(ee)/api/partners/analytics/route.ts b/apps/web/app/(ee)/api/partners/analytics/route.ts index 49e41c29fee..1a1225e76d1 100644 --- a/apps/web/app/(ee)/api/partners/analytics/route.ts +++ b/apps/web/app/(ee)/api/partners/analytics/route.ts @@ -4,12 +4,16 @@ import { DubApiError } from "@/lib/api/errors"; import { getDefaultProgramIdOrThrow } from "@/lib/api/programs/get-default-program-id-or-throw"; import { withWorkspace } from "@/lib/auth"; import { throwIfNoPartnerIdOrTenantId } from "@/lib/partners/throw-if-no-partnerid-tenantid"; -import { sqlGranularityMap } from "@/lib/planetscale/granularity"; +import { + pgDateBucket, + sqlGranularityMap, +} from "@/lib/postgres/granularity"; import { partnerAnalyticsQuerySchema, partnersTopLinksSchema, } from "@/lib/zod/schemas/partners"; import { prisma } from "@dub/prisma"; +import { Prisma } from "@dub/prisma/client"; import { parseFilterValue } from "@dub/utils"; import { format } from "date-fns"; import { NextResponse } from "next/server"; @@ -124,18 +128,18 @@ export const GET = withWorkspace( const earnings = await prisma.$queryRaw< { start: string; earnings: number }[] >` - SELECT - DATE_FORMAT(CONVERT_TZ(createdAt, '+00:00', ${timezone || "+00:00"}), ${dateFormat}) AS start, + SELECT + ${pgDateBucket({ column: Prisma.sql`"createdAt"`, timezone: timezone || "UTC", dateFormat })} AS start, SUM(earnings) AS earnings - FROM Commission - WHERE + FROM "Commission" + WHERE earnings > 0 - AND programId = ${programEnrollment.programId} - AND partnerId = ${programEnrollment.partnerId} + AND "programId" = ${programEnrollment.programId} + AND "partnerId" = ${programEnrollment.partnerId} AND status in ('pending', 'processed', 'paid') AND type = 'sale' - AND createdAt >= ${startDate} - AND createdAt < ${endDate} + AND "createdAt" >= ${startDate} + AND "createdAt" < ${endDate} GROUP BY start ORDER BY start ASC;`; diff --git a/apps/web/app/(ee)/api/partners/applications/analytics/route.ts b/apps/web/app/(ee)/api/partners/applications/analytics/route.ts index 581332a9544..b7625b0894a 100644 --- a/apps/web/app/(ee)/api/partners/applications/analytics/route.ts +++ b/apps/web/app/(ee)/api/partners/applications/analytics/route.ts @@ -5,7 +5,10 @@ import { applicationEventAnalyticsSchema, } from "@/lib/application-events/schema"; import { withWorkspace } from "@/lib/auth"; -import { sqlGranularityMap } from "@/lib/planetscale/granularity"; +import { + pgDateBucket, + sqlGranularityMap, +} from "@/lib/postgres/granularity"; import { ApplicationEventAnalyticsQuery } from "@/lib/types"; import { TZDate, tz } from "@date-fns/tz"; import { prisma } from "@dub/prisma"; @@ -52,7 +55,7 @@ export const GET = withWorkspace(async ({ workspace, searchParams }) => { timezone: timezoneParam, } = parsedFilters; - // Align with CONVERT_TZ in raw SQL and analyticsQuerySchema default (UTC when omitted). + // Align raw SQL bucketing and analyticsQuerySchema default (UTC when omitted). const timezone = timezoneParam ?? "UTC"; const { startDate, endDate } = getStartEndDates({ @@ -248,17 +251,17 @@ async function byTimeseries({ const referralSourceFilter = parseFilterValue(referralSource); const conditions: Prisma.Sql[] = [ - Prisma.sql`e.programId = ${programId}`, - Prisma.sql`e.visitedAt >= ${startDate}`, - Prisma.sql`e.visitedAt < ${endDate}`, + Prisma.sql`e."programId" = ${programId}`, + Prisma.sql`e."visitedAt" >= ${startDate}`, + Prisma.sql`e."visitedAt" < ${endDate}`, ]; if (partnerFilter) { const list = Prisma.join(partnerFilter.values.map((v) => Prisma.sql`${v}`)); conditions.push( partnerFilter.sqlOperator === "NOT IN" - ? Prisma.sql`e.partnerId NOT IN (${list})` - : Prisma.sql`e.partnerId IN (${list})`, + ? Prisma.sql`e."referredByPartnerId" NOT IN (${list})` + : Prisma.sql`e."referredByPartnerId" IN (${list})`, ); } @@ -268,8 +271,8 @@ async function byTimeseries({ ); conditions.push( referralSourceFilter.sqlOperator === "NOT IN" - ? Prisma.sql`e.referralSource NOT IN (${list})` - : Prisma.sql`e.referralSource IN (${list})`, + ? Prisma.sql`e."referralSource" NOT IN (${list})` + : Prisma.sql`e."referralSource" IN (${list})`, ); } @@ -287,13 +290,13 @@ async function byTimeseries({ const rows = await prisma.$queryRaw( Prisma.sql` SELECT - DATE_FORMAT(CONVERT_TZ(e.visitedAt, "UTC", ${tzId}), ${dateFormat}) AS start, - COUNT(e.visitedAt) AS visits, - COUNT(e.startedAt) AS starts, - COUNT(e.submittedAt) AS submissions, - COUNT(e.approvedAt) AS approvals, - COUNT(e.rejectedAt) AS rejections - FROM ProgramApplicationEvent e + ${pgDateBucket({ column: Prisma.sql`e."visitedAt"`, timezone: tzId, dateFormat })} AS start, + COUNT(e."visitedAt") AS visits, + COUNT(e."startedAt") AS starts, + COUNT(e."submittedAt") AS submissions, + COUNT(e."approvedAt") AS approvals, + COUNT(e."rejectedAt") AS rejections + FROM "ProgramApplicationEvent" e WHERE ${whereClause} GROUP BY start ORDER BY start ASC`, diff --git a/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/count/route.ts b/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/count/route.ts index e8262414b44..83220b5501f 100644 --- a/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/count/route.ts +++ b/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/count/route.ts @@ -35,8 +35,20 @@ export const GET = withWorkspace( ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), }; diff --git a/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/route.ts b/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/route.ts index dddd683cfa1..28345ec9a33 100644 --- a/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/route.ts +++ b/apps/web/app/(ee)/api/programs/[programId]/submitted-leads/route.ts @@ -40,8 +40,20 @@ export const GET = withWorkspace( ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), }, diff --git a/apps/web/app/(ee)/api/shopify/pixel/route.ts b/apps/web/app/(ee)/api/shopify/pixel/route.ts index 7723bd31fa6..0a02e81cec9 100644 --- a/apps/web/app/(ee)/api/shopify/pixel/route.ts +++ b/apps/web/app/(ee)/api/shopify/pixel/route.ts @@ -1,7 +1,7 @@ import { COMMON_CORS_HEADERS } from "@/lib/api/cors"; import { DubApiError, handleAndReturnErrorResponse } from "@/lib/api/errors"; import { parseRequestBody } from "@/lib/api/utils"; -import { getClickEvent } from "@/lib/tinybird"; +import { getClickEvent } from "@/lib/tinybird/get-click-event"; import { ratelimit, redis } from "@/lib/upstash"; import { LOCALHOST_IP } from "@dub/utils"; import { ipAddress, waitUntil } from "@vercel/functions"; diff --git a/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts b/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts index b9ca0f875f9..cda1bceee85 100644 --- a/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts +++ b/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts @@ -27,7 +27,7 @@ export async function customerSubscriptionDeleted( const stripeId = subscriptionDeleted.customer.toString(); // If a workspace deletes their subscription, reset their usage limit in the database to 1000. - // Also remove the root domain link for all their domains from MySQL, Redis, and Tinybird + // Also remove the root domain link for all their domains from Postgres, Redis, and Tinybird const workspace = await prisma.project.findUnique({ where: { stripeId, @@ -144,7 +144,7 @@ export async function customerSubscriptionDeleted( }, }), - // remove root domain link for all domains from MySQL + // remove root domain link for all domains from Postgres prisma.link.updateMany({ where: { id: { diff --git a/apps/web/app/(ee)/api/track/click/route.ts b/apps/web/app/(ee)/api/track/click/route.ts index 12d6e00260c..757e2ca63a9 100644 --- a/apps/web/app/(ee)/api/track/click/route.ts +++ b/apps/web/app/(ee)/api/track/click/route.ts @@ -10,8 +10,8 @@ import { recordClickCache } from "@/lib/api/links/record-click-cache"; import { parseRequestBody } from "@/lib/api/utils"; import { withAxiom } from "@/lib/axiom/server"; import { getIdentityHash } from "@/lib/middleware/utils/get-identity-hash"; -import { getWorkspaceViaEdge } from "@/lib/planetscale"; -import { getLinkWithPartner } from "@/lib/planetscale/get-link-with-partner"; +import { getWorkspaceViaEdge } from "@/lib/postgres"; +import { getLinkWithPartner } from "@/lib/postgres/get-link-with-partner"; import { recordClick } from "@/lib/tinybird"; import { RedisLinkProps } from "@/lib/types"; import { formatRedisLink, redis, redisGlobalWithTimeout } from "@/lib/upstash"; diff --git a/apps/web/app/(ee)/api/track/open/route.ts b/apps/web/app/(ee)/api/track/open/route.ts index daaeddc6f62..5f42fdec4a9 100644 --- a/apps/web/app/(ee)/api/track/open/route.ts +++ b/apps/web/app/(ee)/api/track/open/route.ts @@ -7,7 +7,7 @@ import { parseRequestBody } from "@/lib/api/utils"; import { withAxiom } from "@/lib/axiom/server"; import { DeepLinkClickData } from "@/lib/middleware/utils/cache-deeplink-click-data"; import { getIdentityHash } from "@/lib/middleware/utils/get-identity-hash"; -import { getLinkViaEdge } from "@/lib/planetscale"; +import { getLinkViaEdge } from "@/lib/postgres"; import { recordClick } from "@/lib/tinybird"; import { RedisLinkProps } from "@/lib/types"; import { formatRedisLink, redis, redisGlobalWithTimeout } from "@/lib/upstash"; diff --git a/apps/web/app/(ee)/api/track/visit/route.ts b/apps/web/app/(ee)/api/track/visit/route.ts index eb398a4e67c..f03229349e7 100644 --- a/apps/web/app/(ee)/api/track/visit/route.ts +++ b/apps/web/app/(ee)/api/track/visit/route.ts @@ -6,7 +6,7 @@ import { recordClickCache } from "@/lib/api/links/record-click-cache"; import { parseRequestBody } from "@/lib/api/utils"; import { withAxiom } from "@/lib/axiom/server"; import { getIdentityHash } from "@/lib/middleware/utils/get-identity-hash"; -import { getLinkViaEdge, getWorkspaceViaEdge } from "@/lib/planetscale"; +import { getLinkViaEdge, getWorkspaceViaEdge } from "@/lib/postgres"; import { recordClick } from "@/lib/tinybird"; import { RedisLinkProps } from "@/lib/types"; import { formatRedisLink, redisGlobalWithTimeout } from "@/lib/upstash"; diff --git a/apps/web/app/[domain]/[key]/inspect/page.tsx b/apps/web/app/[domain]/[key]/inspect/page.tsx index 0411dc27473..8580f9e9531 100644 --- a/apps/web/app/[domain]/[key]/inspect/page.tsx +++ b/apps/web/app/[domain]/[key]/inspect/page.tsx @@ -1,4 +1,4 @@ -import { getLinkViaEdge } from "@/lib/planetscale"; +import { getLinkViaEdge } from "@/lib/postgres"; import { Hero } from "@/ui/placeholders/hero"; import { LinkPreview, LinkPreviewPlaceholder } from "@dub/ui"; import { @@ -12,7 +12,7 @@ import { notFound } from "next/navigation"; import { Suspense } from "react"; import LinkInspectorCard from "./card"; -export const runtime = "edge"; +export const runtime = "nodejs"; export async function generateMetadata(props: { params: Promise<{ domain: string; key: string }>; diff --git a/apps/web/app/[domain]/[key]/proxy/page.tsx b/apps/web/app/[domain]/[key]/proxy/page.tsx index d1d2efb7bff..7dfc46ef257 100644 --- a/apps/web/app/[domain]/[key]/proxy/page.tsx +++ b/apps/web/app/[domain]/[key]/proxy/page.tsx @@ -1,4 +1,4 @@ -import { getLinkViaEdge } from "@/lib/planetscale"; +import { getLinkViaEdge } from "@/lib/postgres"; import { BlurImage } from "@dub/ui"; import { GOOGLE_FAVICON_URL, diff --git a/apps/web/app/api/folders/route.ts b/apps/web/app/api/folders/route.ts index 9ee9fd15663..2c9c601de1c 100644 --- a/apps/web/app/api/folders/route.ts +++ b/apps/web/app/api/folders/route.ts @@ -59,7 +59,7 @@ export const POST = withWorkspace( async (tx) => { const result = await tx.$queryRaw< Array<{ foldersUsage: number; foldersLimit: number }> - >`SELECT foldersUsage, foldersLimit FROM Project WHERE id = ${workspace.id} FOR UPDATE`; + >`SELECT "foldersUsage", "foldersLimit" FROM "Project" WHERE id = ${workspace.id} FOR UPDATE`; const { foldersUsage, foldersLimit } = result[0]; diff --git a/apps/web/app/api/links/exists/route.ts b/apps/web/app/api/links/exists/route.ts index d6af1349dc4..2fcfa9c08e2 100644 --- a/apps/web/app/api/links/exists/route.ts +++ b/apps/web/app/api/links/exists/route.ts @@ -1,12 +1,12 @@ import { DubApiError, handleAndReturnErrorResponse } from "@/lib/api/errors"; import { keyChecks, processKey } from "@/lib/api/links/utils"; -import { getWorkspaceViaEdge } from "@/lib/planetscale"; +import { getWorkspaceViaEdge } from "@/lib/postgres"; import { domainKeySchema } from "@/lib/zod/schemas/links"; import { workspaceIdSchema } from "@/lib/zod/schemas/workspaces"; import { getSearchParams } from "@dub/utils"; import { NextRequest, NextResponse } from "next/server"; -export const runtime = "edge"; +export const runtime = "nodejs"; // GET /api/links/exists – run keyChecks on the key export const GET = async (req: NextRequest) => { diff --git a/apps/web/app/api/links/random/route.ts b/apps/web/app/api/links/random/route.ts index c65eebef693..a1b2ba0c05f 100644 --- a/apps/web/app/api/links/random/route.ts +++ b/apps/web/app/api/links/random/route.ts @@ -1,6 +1,6 @@ import { handleAndReturnErrorResponse } from "@/lib/api/errors"; import { ratelimitOrThrow } from "@/lib/api/utils"; -import { getRandomKey } from "@/lib/planetscale"; +import { getRandomKey } from "@/lib/postgres"; import { domainKeySchema } from "@/lib/zod/schemas/links"; import { getSearchParams } from "@dub/utils"; import { NextRequest, NextResponse } from "next/server"; diff --git a/apps/web/app/api/qr/route.tsx b/apps/web/app/api/qr/route.tsx index 60d9d771380..0997fc2b31d 100644 --- a/apps/web/app/api/qr/route.tsx +++ b/apps/web/app/api/qr/route.tsx @@ -1,14 +1,14 @@ import { handleAndReturnErrorResponse } from "@/lib/api/errors"; import { ratelimitOrThrow } from "@/lib/api/utils"; -import { getShortLinkViaEdge, getWorkspaceViaEdge } from "@/lib/planetscale"; -import { getDomainViaEdge } from "@/lib/planetscale/get-domain-via-edge"; +import { getShortLinkViaEdge, getWorkspaceViaEdge } from "@/lib/postgres"; +import { getDomainViaEdge } from "@/lib/postgres/get-domain-via-edge"; import { QRCodeSVG } from "@/lib/qr/utils"; import { getQRCodeQuerySchema } from "@/lib/zod/schemas/qr"; import { DUB_QR_LOGO, getSearchParams, isDubDomain } from "@dub/utils"; import { ImageResponse } from "next/og"; import { NextRequest } from "next/server"; -export const runtime = "edge"; +export const runtime = "nodejs"; const CORS_HEADERS = new Headers({ "Access-Control-Allow-Origin": "*", diff --git a/apps/web/app/api/workspaces/route.ts b/apps/web/app/api/workspaces/route.ts index 28fd80b4e01..c4b069f2f37 100644 --- a/apps/web/app/api/workspaces/route.ts +++ b/apps/web/app/api/workspaces/route.ts @@ -3,7 +3,7 @@ import { generateRandomString } from "@/lib/api/utils/generate-random-string"; import { createWorkspaceId } from "@/lib/api/workspaces/create-workspace-id"; import { prefixWorkspaceId } from "@/lib/api/workspaces/workspace-id"; import { withSession } from "@/lib/auth"; -import { checkIfUserExists } from "@/lib/planetscale"; +import { checkIfUserExists } from "@/lib/postgres"; import { storage } from "@/lib/storage"; import { createWorkspaceSchema, diff --git a/apps/web/app/password/[linkId]/page.tsx b/apps/web/app/password/[linkId]/page.tsx index 2c375d01655..7ea0675afa7 100644 --- a/apps/web/app/password/[linkId]/page.tsx +++ b/apps/web/app/password/[linkId]/page.tsx @@ -9,7 +9,7 @@ import { notFound, redirect } from "next/navigation"; import PasswordForm from "./form"; export const dynamic = "force-dynamic"; -export const runtime = "edge"; +export const runtime = "nodejs"; const title = "Password Required"; const description = diff --git a/apps/web/docker-compose.yml b/apps/web/docker-compose.yml index 1aeca3974da..bbee06c1772 100644 --- a/apps/web/docker-compose.yml +++ b/apps/web/docker-compose.yml @@ -2,38 +2,17 @@ version: "3.8" services: - ps-mysql: - image: mysql:8.0 + postgres: + image: postgres:16 restart: always environment: - MYSQL_DATABASE: planetscale - MYSQL_ROOT_HOST: "%" - MYSQL_ALLOW_EMPTY_PASSWORD: "yes" - command: - [ - "--max_connections=1000", - "--default-authentication-plugin=mysql_native_password", - ] + POSTGRES_DB: dub + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres ports: - - 3306:3306 + - 5432:5432 volumes: - - ps-mysql:/var/lib/mysql - - planetscale-proxy: - image: ghcr.io/mattrobenolt/ps-http-sim:latest - command: - [ - "-mysql-no-pass", - "-listen-port=3900", - "-mysql-dbname=planetscale", - "-mysql-addr=ps-mysql", - ] - depends_on: - - ps-mysql - ports: - - 3900:3900 - links: - - ps-mysql + - postgres:/var/lib/postgresql/data mailhog: image: "mailhog/mailhog:latest" @@ -42,4 +21,4 @@ services: - "8025:8025" volumes: - ps-mysql: + postgres: diff --git a/apps/web/lib/analytics/get-analytics.ts b/apps/web/lib/analytics/get-analytics.ts index af7655fa431..7be358cfce7 100644 --- a/apps/web/lib/analytics/get-analytics.ts +++ b/apps/web/lib/analytics/get-analytics.ts @@ -5,7 +5,7 @@ import { prisma } from "@dub/prisma"; import { linkConstructor, punyEncode } from "@dub/utils"; import * as z from "zod/v4"; import { decodeKeyIfCaseSensitive } from "../api/links/case-sensitivity"; -import { conn } from "../planetscale"; +import { conn } from "../postgres"; import { analyticsFilterTB } from "../zod/schemas/analytics"; import { analyticsResponse } from "../zod/schemas/analytics-response"; import { @@ -26,8 +26,8 @@ import { getStartEndDates } from "./utils/get-start-end-dates"; // Fetch data for /api/analytics export const getAnalytics = async (params: AnalyticsFilters) => { let { - event, - groupBy, + event = "clicks", + groupBy = "count", workspaceId, linkId, interval, @@ -62,15 +62,21 @@ export const getAnalytics = async (params: AnalyticsFilters) => { ) ) { const linkIdPlaceholders = normalizedLinkId.values.map(() => "?").join(","); + const aggregateColumnMap: Record = { + clicks: `SUM(clicks) AS clicks`, + leads: `SUM(leads) AS leads`, + sales: `SUM(sales) AS sales`, + saleAmount: `SUM("saleAmount") AS "saleAmount"`, + }; const aggregateColumns = event === "composite" - ? `SUM(clicks) as clicks, SUM(leads) as leads, SUM(sales) as sales, SUM(saleAmount) as saleAmount` + ? `${aggregateColumnMap.clicks}, ${aggregateColumnMap.leads}, ${aggregateColumnMap.sales}, ${aggregateColumnMap.saleAmount}` : event === "sales" - ? `SUM(sales) as sales, SUM(saleAmount) as saleAmount` - : `SUM(${event}) as ${event}`; + ? `${aggregateColumnMap.sales}, ${aggregateColumnMap.saleAmount}` + : aggregateColumnMap[event]; const response = await conn.execute( - `SELECT ${aggregateColumns} FROM Link WHERE id IN (${linkIdPlaceholders}) AND projectId = ?`, + `SELECT ${aggregateColumns} FROM "Link" WHERE id IN (${linkIdPlaceholders}) AND projectId = ?`, [...normalizedLinkId.values, workspaceId], ); diff --git a/apps/web/lib/analytics/get-customer-events.ts b/apps/web/lib/analytics/get-customer-events.ts index fb62e4e4cfd..51389467b3d 100644 --- a/apps/web/lib/analytics/get-customer-events.ts +++ b/apps/web/lib/analytics/get-customer-events.ts @@ -37,7 +37,7 @@ export const getCustomerEvents = async ({ const eventData = { ...evt, - // use link domain & key from mysql instead of tinybird + // use link domain & key from Postgres instead of Tinybird domain: link.domain, key: link.key, // timestamp is always in UTC diff --git a/apps/web/lib/analytics/get-events.ts b/apps/web/lib/analytics/get-events.ts index 32441404a8c..17151d788e6 100644 --- a/apps/web/lib/analytics/get-events.ts +++ b/apps/web/lib/analytics/get-events.ts @@ -198,7 +198,7 @@ export const getEvents = async (params: EventsFilters) => { const eventData = { ...evt, - // use link domain & key from mysql instead of tinybird + // use link domain & key from Postgres instead of Tinybird domain: link.domain, key: link.key, // timestamp is always in UTC diff --git a/apps/web/lib/api/campaigns/get-campaign-summary.ts b/apps/web/lib/api/campaigns/get-campaign-summary.ts index 7a5793471c9..7f6b13e4660 100644 --- a/apps/web/lib/api/campaigns/get-campaign-summary.ts +++ b/apps/web/lib/api/campaigns/get-campaign-summary.ts @@ -6,17 +6,17 @@ export const getCampaignSummary = async (campaignId: string) => { const [queryResult] = await prisma.$queryRaw` SELECT COUNT(*) AS sent, - SUM(CASE WHEN deliveredAt IS NOT NULL THEN 1 ELSE 0 END) AS delivered, - SUM(CASE WHEN openedAt IS NOT NULL THEN 1 ELSE 0 END) AS opened, - SUM(CASE WHEN bouncedAt IS NOT NULL THEN 1 ELSE 0 END) AS bounced - FROM NotificationEmail - WHERE campaignId = ${campaignId} + SUM(CASE WHEN "deliveredAt" IS NOT NULL THEN 1 ELSE 0 END) AS delivered, + SUM(CASE WHEN "openedAt" IS NOT NULL THEN 1 ELSE 0 END) AS opened, + SUM(CASE WHEN "bouncedAt" IS NOT NULL THEN 1 ELSE 0 END) AS bounced + FROM "NotificationEmail" + WHERE "campaignId" = ${campaignId} `; return campaignSummarySchema.parse({ - sent: queryResult.sent, - delivered: queryResult.delivered, - opened: queryResult.opened, - bounced: queryResult.bounced, + sent: Number(queryResult.sent), + delivered: Number(queryResult.delivered), + opened: Number(queryResult.opened), + bounced: Number(queryResult.bounced), }); }; diff --git a/apps/web/lib/api/conversions/track-lead.ts b/apps/web/lib/api/conversions/track-lead.ts index 518eab1e37e..34dc0acd4d4 100644 --- a/apps/web/lib/api/conversions/track-lead.ts +++ b/apps/web/lib/api/conversions/track-lead.ts @@ -78,7 +78,7 @@ export const trackLead = async ({ let isDuplicateEvent = false; // if not deferred mode, we need to deduplicate lead events – only record 1 unique event for the same customer and event name - // TODO: Maybe we can replace this to rely only on MySQL directly since we're checking the customer above? + // TODO: Maybe we can replace this to rely only on Postgres directly since we're checking the customer above? if (mode !== "deferred") { const res = await redis.set( `trackLead:${workspace.id}:${customerExternalId}:${stringifiedEventName}`, @@ -166,7 +166,7 @@ export const trackLead = async ({ : basePayload; }; - // if the customer doesn't exist in our MySQL DB yet, upsert it + // if the customer doesn't exist in our Postgres DB yet, upsert it // (here we're doing upsert and not create in case of race conditions) if (!customer) { customer = await prisma.customer.upsert({ diff --git a/apps/web/lib/api/groups/get-groups.ts b/apps/web/lib/api/groups/get-groups.ts index 2436af2980d..0a3cdbd0d68 100644 --- a/apps/web/lib/api/groups/get-groups.ts +++ b/apps/web/lib/api/groups/get-groups.ts @@ -19,62 +19,73 @@ export async function getGroups(filters: GroupFilters) { includeExpandedFields, } = filters; + const sortColumnMap = { + createdAt: `pg."createdAt"`, + totalPartners: `"totalPartners"`, + totalClicks: `"totalClicks"`, + totalLeads: `"totalLeads"`, + totalSales: `"totalSales"`, + totalSaleAmount: `"totalSaleAmount"`, + totalConversions: `"totalConversions"`, + totalCommissions: `"totalCommissions"`, + } satisfies Record; + const groups = (await prisma.$queryRaw(Prisma.sql` SELECT pg.id, - pg.programId, + pg."programId", pg.name, pg.slug, pg.color, - pg.clickRewardId, - pg.leadRewardId, - pg.saleRewardId, - pg.discountId, - pg.additionalLinks, - pg.maxPartnerLinks, - pg.linkStructure, - pg.applicationFormData, - pg.applicationFormPublishedAt, - pg.landerData, - pg.landerPublishedAt, + pg."clickRewardId", + pg."leadRewardId", + pg."saleRewardId", + pg."discountId", + pg."additionalLinks", + pg."maxPartnerLinks", + pg."linkStructure", + pg."applicationFormData", + pg."applicationFormPublishedAt", + pg."landerData", + pg."landerPublishedAt", pg.logo, pg.wordmark, - pg.brandColor, - pg.holdingPeriodDays, - pg.autoApprovePartnersEnabledAt, - pg.utmTemplateId, - pg.createdAt, - pg.updatedAt, + pg."brandColor", + pg."holdingPeriodDays", + pg."autoApprovePartnersEnabledAt", + pg."utmTemplateId", + pg."createdAt", + pg."updatedAt", ${ includeExpandedFields ? Prisma.sql` - COUNT(DISTINCT pe.partnerId) as totalPartners, - COALESCE(SUM(pe.totalClicks), 0) as totalClicks, - COALESCE(SUM(pe.totalLeads), 0) as totalLeads, - COALESCE(SUM(pe.totalSales), 0) as totalSales, - COALESCE(SUM(pe.totalSaleAmount), 0) as totalSaleAmount, - COALESCE(SUM(pe.totalConversions), 0) as totalConversions, - COALESCE(SUM(pe.totalCommissions), 0) as totalCommissions, - COALESCE(SUM(pe.totalSaleAmount), 0) - COALESCE(SUM(pe.totalCommissions), 0) as netRevenue + COUNT(DISTINCT pe."partnerId") as "totalPartners", + COALESCE(SUM(pe."totalClicks"), 0) as "totalClicks", + COALESCE(SUM(pe."totalLeads"), 0) as "totalLeads", + COALESCE(SUM(pe."totalSales"), 0) as "totalSales", + COALESCE(SUM(pe."totalSaleAmount"), 0) as "totalSaleAmount", + COALESCE(SUM(pe."totalConversions"), 0) as "totalConversions", + COALESCE(SUM(pe."totalCommissions"), 0) as "totalCommissions", + COALESCE(SUM(pe."totalSaleAmount"), 0) - COALESCE(SUM(pe."totalCommissions"), 0) as "netRevenue" ` : Prisma.sql` - 0 as totalPartners, - 0 as totalClicks, - 0 as totalLeads, - 0 as totalSales, - 0 as totalSaleAmount, - 0 as totalConversions, - 0 as totalCommissions, - 0 as netRevenue + 0 as "totalPartners", + 0 as "totalClicks", + 0 as "totalLeads", + 0 as "totalSales", + 0 as "totalSaleAmount", + 0 as "totalConversions", + 0 as "totalCommissions", + 0 as "netRevenue" ` } - FROM PartnerGroup pg - ${includeExpandedFields ? Prisma.sql`LEFT JOIN ProgramEnrollment pe ON pe.groupId = pg.id AND pe.status = 'approved'` : Prisma.sql``} - WHERE pg.programId = ${programId} - ${search ? Prisma.sql`AND (pg.name LIKE ${`%${search}%`} OR pg.slug LIKE ${`%${search}%`})` : Prisma.sql``} + FROM "PartnerGroup" pg + ${includeExpandedFields ? Prisma.sql`LEFT JOIN "ProgramEnrollment" pe ON pe."groupId" = pg.id AND pe.status = 'approved'` : Prisma.sql``} + WHERE pg."programId" = ${programId} + ${search ? Prisma.sql`AND (pg.name ILIKE ${`%${search}%`} OR pg.slug ILIKE ${`%${search}%`})` : Prisma.sql``} ${groupIds && groupIds.length > 0 ? Prisma.sql`AND pg.id IN (${Prisma.join(groupIds)})` : Prisma.sql``} GROUP BY pg.id - ORDER BY ${Prisma.raw(sortBy === "createdAt" ? "pg.createdAt" : sortBy)} ${Prisma.raw(sortOrder)} + ORDER BY ${Prisma.raw(sortColumnMap[sortBy])} ${Prisma.raw(sortOrder)} LIMIT ${pageSize} OFFSET ${(page - 1) * pageSize} `)) satisfies Array; diff --git a/apps/web/lib/api/links/cache.ts b/apps/web/lib/api/links/cache.ts index cdb40a5a885..32c32c1e7a2 100644 --- a/apps/web/lib/api/links/cache.ts +++ b/apps/web/lib/api/links/cache.ts @@ -1,4 +1,4 @@ -import { getLinkViaEdge } from "@/lib/planetscale"; +import { getLinkViaEdge } from "@/lib/postgres"; import { LinkProps, RedisLinkProps } from "@/lib/types"; import { formatRedisLink, @@ -90,7 +90,7 @@ class LinkCache { return cachedLink; } else { console.log( - `[Redis Cache MISS] ${cacheKey} - Not found in LRU or Redis, falling back to MySQL...`, + `[Redis Cache MISS] ${cacheKey} - Not found in LRU or Redis, falling back to Postgres...`, ); return null; } @@ -104,7 +104,9 @@ class LinkCache { return cachedLink; } - console.log(`[Vercel Cache MISS] ${cacheKey} - Falling back to MySQL...`); + console.log( + `[Vercel Cache MISS] ${cacheKey} - Falling back to Postgres...`, + ); const linkData = await getLinkViaEdge({ domain, diff --git a/apps/web/lib/api/links/create-link.ts b/apps/web/lib/api/links/create-link.ts index 7d9f747c938..37505381468 100644 --- a/apps/web/lib/api/links/create-link.ts +++ b/apps/web/lib/api/links/create-link.ts @@ -1,5 +1,5 @@ import { qstash } from "@/lib/cron"; -import { getPartnerEnrollmentInfo } from "@/lib/planetscale/get-partner-enrollment-info"; +import { getPartnerEnrollmentInfo } from "@/lib/postgres/get-partner-enrollment-info"; import { isNotHostedImage, storage } from "@/lib/storage"; import { recordLink } from "@/lib/tinybird"; import { ProcessedLinkProps } from "@/lib/types"; diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts index 9b772647865..83de851ead8 100644 --- a/apps/web/lib/api/links/process-link.ts +++ b/apps/web/lib/api/links/process-link.ts @@ -1,6 +1,6 @@ import { isBlacklistedDomain } from "@/lib/edge-config"; import { verifyFolderAccess } from "@/lib/folder/permissions"; -import { checkIfUserExists, getRandomKey } from "@/lib/planetscale"; +import { checkIfUserExists, getRandomKey } from "@/lib/postgres"; import { isNotHostedImage } from "@/lib/storage"; import { NewLinkProps, ProcessedLinkProps } from "@/lib/types"; import { prisma } from "@dub/prisma"; diff --git a/apps/web/lib/api/links/update-link.ts b/apps/web/lib/api/links/update-link.ts index 4780b1719a2..765fad8b414 100644 --- a/apps/web/lib/api/links/update-link.ts +++ b/apps/web/lib/api/links/update-link.ts @@ -1,4 +1,4 @@ -import { getPartnerEnrollmentInfo } from "@/lib/planetscale/get-partner-enrollment-info"; +import { getPartnerEnrollmentInfo } from "@/lib/postgres/get-partner-enrollment-info"; import { isNotHostedImage, storage } from "@/lib/storage"; import { recordLink } from "@/lib/tinybird"; import { LinkProps, ProcessedLinkProps } from "@/lib/types"; diff --git a/apps/web/lib/api/links/utils/key-checks.ts b/apps/web/lib/api/links/utils/key-checks.ts index cc34e7fdf13..ea25dc6c5a1 100644 --- a/apps/web/lib/api/links/utils/key-checks.ts +++ b/apps/web/lib/api/links/utils/key-checks.ts @@ -1,6 +1,6 @@ import { DubApiError } from "@/lib/api/errors"; import { isBlacklistedKey, isReservedUsername } from "@/lib/edge-config"; -import { checkIfKeyExists } from "@/lib/planetscale"; +import { checkIfKeyExists } from "@/lib/postgres"; import { Project } from "@dub/prisma/client"; import { DEFAULT_REDIRECTS, diff --git a/apps/web/lib/api/network/calculate-partner-ranking.ts b/apps/web/lib/api/network/calculate-partner-ranking.ts index fb21e1fed34..2eea60e99a9 100644 --- a/apps/web/lib/api/network/calculate-partner-ranking.ts +++ b/apps/web/lib/api/network/calculate-partner-ranking.ts @@ -49,9 +49,9 @@ export async function calculatePartnerRanking({ similarPrograms = [], }: PartnerRankingParams) { const conditions: Prisma.Sql[] = [ - Prisma.sql`p.networkStatus IN ("approved", "trusted")`, - Prisma.sql`COALESCE(pe.clickToConversionRate, 0) < 1`, - Prisma.sql`(dp.ignoredAt IS NULL OR dp.id IS NULL)`, + Prisma.sql`p."networkStatus" IN ('approved', 'trusted')`, + Prisma.sql`COALESCE(pe."clickToConversionRate", 0) < 1`, + Prisma.sql`(dp."ignoredAt" IS NULL OR dp.id IS NULL)`, Prisma.sql`enrolled.id IS NULL`, ]; @@ -67,8 +67,8 @@ export async function calculatePartnerRanking({ // Combine both filters into a single EXISTS clause so they apply to the same platform if (platform || subscribers) { const platformConditions: Prisma.Sql[] = [ - Prisma.sql`pp_filter.partnerId = p.id`, - Prisma.sql`pp_filter.verifiedAt IS NOT NULL`, + Prisma.sql`pp_filter."partnerId" = p.id`, + Prisma.sql`pp_filter."verifiedAt" IS NOT NULL`, ]; if (platform) { @@ -97,33 +97,33 @@ export async function calculatePartnerRanking({ } conditions.push( - Prisma.sql`EXISTS ( - SELECT 1 - FROM PartnerPlatform pp_filter - WHERE ${Prisma.join(platformConditions, " AND ")} - )`, + Prisma.sql`EXISTS ( + SELECT 1 + FROM "PartnerPlatform" pp_filter + WHERE ${Prisma.join(platformConditions, " AND ")} + )`, ); } if (starred === true) { - conditions.push(Prisma.sql`dp.starredAt IS NOT NULL`); + conditions.push(Prisma.sql`dp."starredAt" IS NOT NULL`); } else if (starred === false) { - conditions.push(Prisma.sql`(dp.starredAt IS NULL OR dp.id IS NULL)`); + conditions.push(Prisma.sql`(dp."starredAt" IS NULL OR dp.id IS NULL)`); } const whereClause = Prisma.join(conditions, " AND "); // Rank partners with no platforms lower const hasProfileCheck = Prisma.sql`EXISTS ( - SELECT 1 - FROM PartnerPlatform pp - WHERE pp.partnerId = p.id + SELECT 1 + FROM "PartnerPlatform" pp + WHERE pp."partnerId" = p.id )`; const orderByClause = starred === true - ? Prisma.sql`dp.starredAt ASC` - : Prisma.sql`finalScore DESC, p.id ASC`; + ? Prisma.sql`dp."starredAt" ASC` + : Prisma.sql`"finalScore" DESC, p.id ASC`; const offset = (page - 1) * pageSize; @@ -131,7 +131,7 @@ export async function calculatePartnerRanking({ // This dramatically reduces the dataset from 1.5M to 5,000 before expensive joins const buildDiscoverablePartnersFilter = (alias: string) => { const conditions: Prisma.Sql[] = [ - Prisma.sql`${Prisma.raw(alias)}.networkStatus IN ("approved", "trusted")`, + Prisma.sql`${Prisma.raw(alias)}."networkStatus" IN ('approved', 'trusted')`, ]; if (partnerIds && partnerIds.length > 0) { @@ -149,94 +149,94 @@ export async function calculatePartnerRanking({ // Metrics across ALL programs (for display purposes) const allProgramMetricsJoin = Prisma.sql`LEFT JOIN ( - SELECT - pe_all.partnerId, - MAX(pe_all.lastConversionAt) as lastConversionAt, - AVG(COALESCE(pe_all.clickToConversionRate, 0)) as avgConversionRate - FROM ProgramEnrollment pe_all FORCE INDEX (ProgramEnrollment_partnerId_programId_key) + SELECT + pe_all."partnerId", + MAX(pe_all."lastConversionAt") as "lastConversionAt", + AVG(COALESCE(pe_all."clickToConversionRate", 0)) as "avgConversionRate" + FROM "ProgramEnrollment" pe_all -- OPTIMIZATION: Only process enrollments for discoverable partners (using subquery to avoid JOIN) - WHERE pe_all.partnerId IN ( + WHERE pe_all."partnerId" IN ( SELECT p_filter_all.id - FROM Partner p_filter_all + FROM "Partner" p_filter_all WHERE ${buildDiscoverablePartnersFilter("p_filter_all")} ) - AND pe_all.programId != ${ACME_PROGRAM_ID} - AND pe_all.totalConversions > 0 - GROUP BY pe_all.partnerId - ) allProgramMetrics ON allProgramMetrics.partnerId = p.id`; + AND pe_all."programId" != ${ACME_PROGRAM_ID} + AND pe_all."totalConversions" > 0 + GROUP BY pe_all."partnerId" + ) allProgramMetrics ON allProgramMetrics."partnerId" = p.id`; const similarProgramMetricsJoin = similarPrograms.length > 0 - ? Prisma.sql`LEFT JOIN ( - SELECT - pe2.partnerId, - -- Similarity score: Sum weighted performance (0-50 points, no averaging) - LEAST(50, SUM( - ( - -- Individual program performance score (0-1 range per program) - (COALESCE(pe2.consistencyScore, 50) / 100 * 0.20) + - (CASE - WHEN COALESCE(pe2.clickToConversionRate, 0) <= 0 THEN 0 - WHEN COALESCE(pe2.clickToConversionRate, 0) >= 0.1 THEN 0.10 - ELSE (SQRT(LOG10(COALESCE(pe2.clickToConversionRate, 0) * 1000 + 1)) * 40 / 100) * 0.10 - END) + - (CASE - WHEN COALESCE(pe2.averageLifetimeValue, 0) <= 0 THEN 0 - WHEN COALESCE(pe2.averageLifetimeValue, 0) >= 10000 THEN 0.15 - ELSE (LOG10(COALESCE(pe2.averageLifetimeValue, 0) + 1) * 25 / 100) * 0.15 - END) + - (CASE - WHEN COALESCE(pe2.totalCommissions, 0) <= 0 THEN 0 - WHEN COALESCE(pe2.totalCommissions, 0) >= 100000 THEN 0.05 - ELSE (LOG10(COALESCE(pe2.totalCommissions, 0) + 1) * 22 / 100) * 0.05 - END) - ) * (CASE pe2.programId - ${Prisma.join( - similarPrograms.map( - (sp) => + ? Prisma.sql`LEFT JOIN ( + SELECT + pe2."partnerId", + -- Similarity score: Sum weighted performance (0-50 points, no averaging) + LEAST(50, SUM( + ( + -- Individual program performance score (0-1 range per program) + (COALESCE(pe2."consistencyScore", 50) / 100 * 0.20) + + (CASE + WHEN COALESCE(pe2."clickToConversionRate", 0) <= 0 THEN 0 + WHEN COALESCE(pe2."clickToConversionRate", 0) >= 0.1 THEN 0.10 + ELSE (SQRT(LOG10(COALESCE(pe2."clickToConversionRate", 0) * 1000 + 1)) * 40 / 100) * 0.10 + END) + + (CASE + WHEN COALESCE(pe2."averageLifetimeValue", 0) <= 0 THEN 0 + WHEN COALESCE(pe2."averageLifetimeValue", 0) >= 10000 THEN 0.15 + ELSE (LOG10(COALESCE(pe2."averageLifetimeValue", 0) + 1) * 25 / 100) * 0.15 + END) + + (CASE + WHEN COALESCE(pe2."totalCommissions", 0) <= 0 THEN 0 + WHEN COALESCE(pe2."totalCommissions", 0) >= 100000 THEN 0.05 + ELSE (LOG10(COALESCE(pe2."totalCommissions", 0) + 1) * 22 / 100) * 0.05 + END) + ) * (CASE pe2."programId" + ${Prisma.join( + similarPrograms.map( + (sp) => Prisma.sql`WHEN ${sp.programId} THEN ${sp.similarityScore}`, ), " ", )} - ELSE 0 END) * 50 -- Weight by similarity, scale to 0-50 range - )) as similarityScore, - -- Program match score: Count of similar programs (0-15 points) - LEAST(15, COUNT(DISTINCT pe2.programId) * 2) as programMatchScore - FROM ProgramEnrollment pe2 FORCE INDEX (ProgramEnrollment_partnerId_programId_key) - -- OPTIMIZATION: Only process enrollments for discoverable partners (using subquery to avoid JOIN) - WHERE pe2.partnerId IN ( - SELECT p_filter.id - FROM Partner p_filter - WHERE ${buildDiscoverablePartnersFilter("p_filter")} - ) - AND pe2.programId IN (${Prisma.join(similarPrograms.map((sp) => sp.programId))}) - AND pe2.status = 'approved' - GROUP BY pe2.partnerId - ) similarProgramMetrics ON similarProgramMetrics.partnerId = p.id` - : Prisma.sql`LEFT JOIN ( - SELECT - NULL as partnerId, - NULL as similarityScore, - NULL as programMatchScore - WHERE FALSE - ) similarProgramMetrics ON similarProgramMetrics.partnerId = p.id`; - - const partners = await prisma.$queryRaw>` - SELECT - p.*, - COALESCE(pe.lastConversionAt, allProgramMetrics.lastConversionAt) as lastConversionAt, - COALESCE(pe.clickToConversionRate, allProgramMetrics.avgConversionRate) as conversionRate, - dp.starredAt, - dp.ignoredAt, - dp.invitedAt, - partnerCategories.categories as categories, - CASE WHEN enrolled.status = 'approved' THEN enrolled.createdAt ELSE NULL END as recruitedAt, - preferredEarningStructuresData.preferredEarningStructures as preferredEarningStructures, - salesChannelsData.salesChannels as salesChannels, - partnerPlatformsData.platforms as platforms, - - -- Pre-compute hasProfileCheck for faster sorting - ${hasProfileCheck} as hasProfile, + ELSE 0 END) * 50 -- Weight by similarity, scale to 0-50 range + )) as "similarityScore", + -- Program match score: Count of similar programs (0-15 points) + LEAST(15, COUNT(DISTINCT pe2."programId") * 2) as "programMatchScore" + FROM "ProgramEnrollment" pe2 + -- OPTIMIZATION: Only process enrollments for discoverable partners (using subquery to avoid JOIN) + WHERE pe2."partnerId" IN ( + SELECT p_filter.id + FROM "Partner" p_filter + WHERE ${buildDiscoverablePartnersFilter("p_filter")} + ) + AND pe2."programId" IN (${Prisma.join(similarPrograms.map((sp) => sp.programId))}) + AND pe2.status = 'approved' + GROUP BY pe2."partnerId" + ) similarProgramMetrics ON similarProgramMetrics."partnerId" = p.id` + : Prisma.sql`LEFT JOIN ( + SELECT + NULL::text as "partnerId", + NULL::double precision as "similarityScore", + NULL::double precision as "programMatchScore" + WHERE FALSE + ) similarProgramMetrics ON similarProgramMetrics."partnerId" = p.id`; + + const partners = await prisma.$queryRaw>` + SELECT + p.*, + COALESCE(pe."lastConversionAt", allProgramMetrics."lastConversionAt") as "lastConversionAt", + COALESCE(pe."clickToConversionRate", allProgramMetrics."avgConversionRate") as "conversionRate", + dp."starredAt", + dp."ignoredAt", + dp."invitedAt", + partnerCategories.categories as categories, + CASE WHEN enrolled.status = 'approved' THEN enrolled."createdAt" ELSE NULL END as "recruitedAt", + preferredEarningStructuresData."preferredEarningStructures" as "preferredEarningStructures", + salesChannelsData."salesChannels" as "salesChannels", + partnerPlatformsData.platforms as platforms, + + -- Pre-compute hasProfileCheck for faster sorting + ${hasProfileCheck} as "hasProfile", -- FINAL SCORE (0-765+ points): Similarity-based ranking for discovery -- Trusted partners (networkStatus = "trusted") get 200 bonus points to rank at the top @@ -245,99 +245,99 @@ export async function calculatePartnerRanking({ -- Profile bonus: 500 points for partners with platforms (ensures they rank above those without) CASE WHEN ${hasProfileCheck} THEN 500 ELSE 0 END + -- Trusted partner bonus: 200 points for partners with networkStatus = "trusted" - CASE WHEN p.networkStatus = "trusted" THEN 200 ELSE 0 END + - COALESCE(similarProgramMetrics.similarityScore, 0) + - COALESCE(similarProgramMetrics.programMatchScore, 0) - ) as finalScore + CASE WHEN p."networkStatus" = 'trusted' THEN 200 ELSE 0 END + + COALESCE(similarProgramMetrics."similarityScore", 0) + + COALESCE(similarProgramMetrics."programMatchScore", 0) + ) as "finalScore" FROM ( -- OPTIMIZATION: Filter to discoverable partners FIRST using subquery -- This dramatically reduces the dataset from 1.5M to 5,000 before expensive joins SELECT p_sub.* - FROM Partner p_sub + FROM "Partner" p_sub WHERE ${buildDiscoverablePartnersFilter("p_sub")} ) p - - -- Current program enrollment (for display metrics and filtering) - LEFT JOIN ProgramEnrollment pe ON pe.partnerId = p.id AND pe.programId = ${programId} - - -- Enrollment status for the current program - LEFT JOIN ProgramEnrollment enrolled ON enrolled.partnerId = p.id AND enrolled.programId = ${programId} - - -- Discovered partner metadata - LEFT JOIN DiscoveredPartner dp ON dp.partnerId = p.id AND dp.programId = ${programId} + + -- Current program enrollment (for display metrics and filtering) + LEFT JOIN "ProgramEnrollment" pe ON pe."partnerId" = p.id AND pe."programId" = ${programId} + + -- Enrollment status for the current program + LEFT JOIN "ProgramEnrollment" enrolled ON enrolled."partnerId" = p.id AND enrolled."programId" = ${programId} + + -- Discovered partner metadata + LEFT JOIN "DiscoveredPartner" dp ON dp."partnerId" = p.id AND dp."programId" = ${programId} ${allProgramMetricsJoin} ${similarProgramMetricsJoin} - -- OPTIMIZATION: Only get categories for discoverable partners - LEFT JOIN ( - SELECT - pe5.partnerId, - GROUP_CONCAT(DISTINCT pc.category ORDER BY pc.category SEPARATOR ',') as categories - FROM ProgramEnrollment pe5 FORCE INDEX (ProgramEnrollment_partnerId_programId_key) - JOIN ProgramCategory pc ON pc.programId = pe5.programId - WHERE pe5.partnerId IN ( - SELECT p_cat.id - FROM Partner p_cat - WHERE ${buildDiscoverablePartnersFilter("p_cat")} - ) - AND pe5.status = 'approved' - GROUP BY pe5.partnerId - ) partnerCategories ON partnerCategories.partnerId = p.id + -- OPTIMIZATION: Only get categories for discoverable partners + LEFT JOIN ( + SELECT + pe5."partnerId", + string_agg(DISTINCT pc.category, ',' ORDER BY pc.category) as categories + FROM "ProgramEnrollment" pe5 + JOIN "ProgramCategory" pc ON pc."programId" = pe5."programId" + WHERE pe5."partnerId" IN ( + SELECT p_cat.id + FROM "Partner" p_cat + WHERE ${buildDiscoverablePartnersFilter("p_cat")} + ) + AND pe5.status = 'approved' + GROUP BY pe5."partnerId" + ) partnerCategories ON partnerCategories."partnerId" = p.id -- OPTIMIZATION: Only get preferred earning structures for discoverable partners - LEFT JOIN ( - SELECT - ppes.partnerId, - GROUP_CONCAT(DISTINCT ppes.preferredEarningStructure ORDER BY ppes.preferredEarningStructure SEPARATOR ',') as preferredEarningStructures - FROM PartnerPreferredEarningStructure ppes - WHERE ppes.partnerId IN ( - SELECT p_filter.id - FROM Partner p_filter - WHERE ${buildDiscoverablePartnersFilter("p_filter")} - ) - GROUP BY ppes.partnerId - ) preferredEarningStructuresData ON preferredEarningStructuresData.partnerId = p.id + LEFT JOIN ( + SELECT + ppes."partnerId", + string_agg(DISTINCT ppes."preferredEarningStructure"::text, ',' ORDER BY ppes."preferredEarningStructure"::text) as "preferredEarningStructures" + FROM "PartnerPreferredEarningStructure" ppes + WHERE ppes."partnerId" IN ( + SELECT p_filter.id + FROM "Partner" p_filter + WHERE ${buildDiscoverablePartnersFilter("p_filter")} + ) + GROUP BY ppes."partnerId" + ) preferredEarningStructuresData ON preferredEarningStructuresData."partnerId" = p.id -- OPTIMIZATION: Only get sales channels for discoverable partners - LEFT JOIN ( - SELECT - psc.partnerId, - GROUP_CONCAT(DISTINCT psc.salesChannel ORDER BY psc.salesChannel SEPARATOR ',') as salesChannels - FROM PartnerSalesChannel psc - WHERE psc.partnerId IN ( - SELECT p_filter.id - FROM Partner p_filter - WHERE ${buildDiscoverablePartnersFilter("p_filter")} - ) - GROUP BY psc.partnerId - ) salesChannelsData ON salesChannelsData.partnerId = p.id + LEFT JOIN ( + SELECT + psc."partnerId", + string_agg(DISTINCT psc."salesChannel"::text, ',' ORDER BY psc."salesChannel"::text) as "salesChannels" + FROM "PartnerSalesChannel" psc + WHERE psc."partnerId" IN ( + SELECT p_filter.id + FROM "Partner" p_filter + WHERE ${buildDiscoverablePartnersFilter("p_filter")} + ) + GROUP BY psc."partnerId" + ) salesChannelsData ON salesChannelsData."partnerId" = p.id -- OPTIMIZATION: Only get platforms for discoverable partners - LEFT JOIN ( - SELECT - pp.partnerId, - JSON_ARRAYAGG( - JSON_OBJECT( - 'partnerId', pp.partnerId, - 'type', pp.type, - 'identifier', pp.identifier, - 'verifiedAt', pp.verifiedAt, - 'platformId', pp.platformId, - 'subscribers', pp.subscribers, - 'posts', pp.posts, - 'views', pp.views - ) - ) as platforms - FROM PartnerPlatform pp - WHERE pp.partnerId IN ( - SELECT p_filter.id - FROM Partner p_filter - WHERE ${buildDiscoverablePartnersFilter("p_filter")} - ) - GROUP BY pp.partnerId - ) partnerPlatformsData ON partnerPlatformsData.partnerId = p.id + LEFT JOIN ( + SELECT + pp."partnerId", + jsonb_agg( + jsonb_build_object( + 'partnerId', pp."partnerId", + 'type', pp.type, + 'identifier', pp.identifier, + 'verifiedAt', pp."verifiedAt", + 'platformId', pp."platformId", + 'subscribers', pp.subscribers, + 'posts', pp.posts, + 'views', pp.views + ) + ) as platforms + FROM "PartnerPlatform" pp + WHERE pp."partnerId" IN ( + SELECT p_filter.id + FROM "Partner" p_filter + WHERE ${buildDiscoverablePartnersFilter("p_filter")} + ) + GROUP BY pp."partnerId" + ) partnerPlatformsData ON partnerPlatformsData."partnerId" = p.id WHERE ${whereClause} ORDER BY ${orderByClause} @@ -355,7 +355,7 @@ export async function calculatePartnerRanking({ : partner.platforms; // Transform platforms to match Prisma types - // MySQL JSON returns BigInt as numbers and DateTime as strings + // Raw SQL JSON returns BigInt as numbers and DateTime as strings platforms = (Array.isArray(parsedPlatforms) ? parsedPlatforms : []).map( (platform: any) => ({ ...platform, diff --git a/apps/web/lib/api/partner-profile/get-partner-earnings-timeseries.ts b/apps/web/lib/api/partner-profile/get-partner-earnings-timeseries.ts index 695e228d2ba..3c54fb55467 100644 --- a/apps/web/lib/api/partner-profile/get-partner-earnings-timeseries.ts +++ b/apps/web/lib/api/partner-profile/get-partner-earnings-timeseries.ts @@ -1,6 +1,9 @@ import { getStartEndDates } from "@/lib/analytics/utils/get-start-end-dates"; import { getProgramEnrollmentOrThrow } from "@/lib/api/programs/get-program-enrollment-or-throw"; -import { sqlGranularityMap } from "@/lib/planetscale/granularity"; +import { + pgDateBucket, + sqlGranularityMap, +} from "@/lib/postgres/granularity"; import { getPartnerEarningsTimeseriesSchema } from "@/lib/zod/schemas/partner-profile"; import { prisma } from "@dub/prisma"; import { Prisma } from "@dub/prisma/client"; @@ -50,23 +53,23 @@ export async function getPartnerEarningsTimeseries({ sqlGranularityMap[granularity]; const query = Prisma.sql` - SELECT - DATE_FORMAT(CONVERT_TZ(createdAt, "UTC", ${timezone || "UTC"}), ${dateFormat}) AS start, - ${groupBy ? (groupBy === "type" ? Prisma.sql`type,` : Prisma.sql`linkId,`) : Prisma.sql``} + SELECT + ${pgDateBucket({ column: Prisma.sql`"createdAt"`, timezone: timezone || "UTC", dateFormat })} AS start, + ${groupBy ? (groupBy === "type" ? Prisma.sql`type,` : Prisma.sql`"linkId",`) : Prisma.sql``} SUM(earnings) AS earnings - FROM Commission - WHERE + FROM "Commission" + WHERE earnings != 0 - AND programId = ${program.id} - AND partnerId = ${partnerId} - AND createdAt >= ${startDate} - AND createdAt < ${endDate} + AND "programId" = ${program.id} + AND "partnerId" = ${partnerId} + AND "createdAt" >= ${startDate} + AND "createdAt" < ${endDate} ${type ? Prisma.sql`AND type = ${type}` : Prisma.sql``} - ${payoutId ? Prisma.sql`AND payoutId = ${payoutId}` : Prisma.sql``} - ${linkId ? Prisma.sql`AND linkId = ${linkId}` : Prisma.sql``} - ${customerId ? Prisma.sql`AND customerId = ${customerId}` : Prisma.sql``} + ${payoutId ? Prisma.sql`AND "payoutId" = ${payoutId}` : Prisma.sql``} + ${linkId ? Prisma.sql`AND "linkId" = ${linkId}` : Prisma.sql``} + ${customerId ? Prisma.sql`AND "customerId" = ${customerId}` : Prisma.sql``} ${status ? Prisma.sql`AND status = ${status}` : Prisma.sql``} - GROUP BY start${groupBy ? (groupBy === "type" ? Prisma.sql`, type` : Prisma.sql`, linkId`) : Prisma.sql``} + GROUP BY start${groupBy ? (groupBy === "type" ? Prisma.sql`, type` : Prisma.sql`, "linkId"`) : Prisma.sql``} ORDER BY start ASC; `; diff --git a/apps/web/lib/api/partners/bulk-delete-partners.ts b/apps/web/lib/api/partners/bulk-delete-partners.ts index b0e6f947b03..a5b264ae0bc 100644 --- a/apps/web/lib/api/partners/bulk-delete-partners.ts +++ b/apps/web/lib/api/partners/bulk-delete-partners.ts @@ -1,4 +1,4 @@ -import { conn } from "@/lib/planetscale"; +import { conn } from "@/lib/postgres"; import { prisma } from "@dub/prisma"; import { ACME_PROGRAM_ID } from "@dub/utils"; import { deleteDiscountCodes } from "../../discounts/delete-discount-code"; @@ -208,7 +208,7 @@ export async function bulkDeletePartners({ if (deletePartners) { // using conn.execute here since Prisma is throwing a weird error const res = await conn.execute( - `DELETE FROM Partner WHERE id IN (${partnerIds.map(() => "?").join(",")})`, + `DELETE FROM "Partner" WHERE id IN (${partnerIds.map(() => "?").join(",")})`, partnerIds, ); console.log(JSON.stringify(res, null, 2)); diff --git a/apps/web/lib/api/partners/get-partner-rewind.ts b/apps/web/lib/api/partners/get-partner-rewind.ts index 7653b5f9dd0..4e885ae650b 100644 --- a/apps/web/lib/api/partners/get-partner-rewind.ts +++ b/apps/web/lib/api/partners/get-partner-rewind.ts @@ -22,31 +22,31 @@ export async function getPartnerRewind({ >` SELECT pr.id, - pr.partnerId, + pr."partnerId", pr.year, - pr.totalClicks, - pr.totalLeads, - pr.totalRevenue, - pr.totalEarnings, - CASE WHEN pr.totalClicks > 0 THEN ROUND( - 100 - 100 * (SELECT COUNT(*) FROM PartnerRewind c WHERE c.year = pr.year AND c.totalClicks >= pr.totalClicks) - / (SELECT COUNT(*) FROM PartnerRewind WHERE year = pr.year) + pr."totalClicks", + pr."totalLeads", + pr."totalRevenue", + pr."totalEarnings", + CASE WHEN pr."totalClicks" > 0 THEN ROUND( + 100 - 100.0 * (SELECT COUNT(*) FROM "PartnerRewind" c WHERE c.year = pr.year AND c."totalClicks" >= pr."totalClicks") + / (SELECT COUNT(*) FROM "PartnerRewind" WHERE year = pr.year) ) ELSE 0 END AS clicksPercentile, - CASE WHEN pr.totalLeads > 0 THEN ROUND( - 100 - 100 * (SELECT COUNT(*) FROM PartnerRewind c WHERE c.year = pr.year AND c.totalLeads >= pr.totalLeads) - / (SELECT COUNT(*) FROM PartnerRewind WHERE year = pr.year) + CASE WHEN pr."totalLeads" > 0 THEN ROUND( + 100 - 100.0 * (SELECT COUNT(*) FROM "PartnerRewind" c WHERE c.year = pr.year AND c."totalLeads" >= pr."totalLeads") + / (SELECT COUNT(*) FROM "PartnerRewind" WHERE year = pr.year) ) ELSE 0 END AS leadsPercentile, - CASE WHEN pr.totalRevenue > 0 THEN ROUND( - 100 - 100 * (SELECT COUNT(*) FROM PartnerRewind c WHERE c.year = pr.year AND c.totalRevenue >= pr.totalRevenue) - / (SELECT COUNT(*) FROM PartnerRewind WHERE year = pr.year) + CASE WHEN pr."totalRevenue" > 0 THEN ROUND( + 100 - 100.0 * (SELECT COUNT(*) FROM "PartnerRewind" c WHERE c.year = pr.year AND c."totalRevenue" >= pr."totalRevenue") + / (SELECT COUNT(*) FROM "PartnerRewind" WHERE year = pr.year) ) ELSE 0 END AS revenuePercentile, - CASE WHEN pr.totalEarnings > 0 THEN ROUND( - 100 - 100 * (SELECT COUNT(*) FROM PartnerRewind c WHERE c.year = pr.year AND c.totalEarnings >= pr.totalEarnings) - / (SELECT COUNT(*) FROM PartnerRewind WHERE year = pr.year) + CASE WHEN pr."totalEarnings" > 0 THEN ROUND( + 100 - 100.0 * (SELECT COUNT(*) FROM "PartnerRewind" c WHERE c.year = pr.year AND c."totalEarnings" >= pr."totalEarnings") + / (SELECT COUNT(*) FROM "PartnerRewind" WHERE year = pr.year) ) ELSE 0 END AS earningsPercentile - FROM PartnerRewind pr + FROM "PartnerRewind" pr WHERE - pr.partnerId = ${partnerId} + pr."partnerId" = ${partnerId} AND pr.year = ${REWIND_YEAR}`; if (!rewinds.length) return null; diff --git a/apps/web/lib/api/partners/program-enrollment-query.ts b/apps/web/lib/api/partners/program-enrollment-query.ts index ec5e71ebc28..e5451bd7e30 100644 --- a/apps/web/lib/api/partners/program-enrollment-query.ts +++ b/apps/web/lib/api/partners/program-enrollment-query.ts @@ -23,9 +23,9 @@ export function buildPartnerEmailSearchWhere({ const q = sanitizeFullTextSearch(search); return { OR: [ - { email: { search: q } }, - { name: { search: q } }, - { companyName: { search: q } }, + { email: { contains: q, mode: "insensitive" } }, + { name: { contains: q, mode: "insensitive" } }, + { companyName: { contains: q, mode: "insensitive" } }, ], }; } diff --git a/apps/web/lib/bounty/api/get-bounty-with-details.ts b/apps/web/lib/bounty/api/get-bounty-with-details.ts index acb707c4415..5fb8ca4f20b 100644 --- a/apps/web/lib/bounty/api/get-bounty-with-details.ts +++ b/apps/web/lib/bounty/api/get-bounty-with-details.ts @@ -14,33 +14,33 @@ export const getBountyWithDetails = async ({ b.name, b.description, b.type, - b.startsAt, - b.endsAt, - b.submissionsOpenAt, - b.submissionFrequency, - b.maxSubmissions, - b.rewardAmount, - b.rewardDescription, - b.submissionRequirements, - b.socialMetricsLastSyncedAt, - b.performanceScope, - wf.triggerConditions, + b."startsAt", + b."endsAt", + b."submissionsOpenAt", + b."submissionFrequency", + b."maxSubmissions", + b."rewardAmount", + b."rewardDescription", + b."submissionRequirements", + b."socialMetricsLastSyncedAt", + b."performanceScope", + wf."triggerConditions", -- Bounty groups COALESCE( ( - SELECT JSON_ARRAYAGG( - JSON_OBJECT('id', groupId) + SELECT jsonb_agg( + jsonb_build_object('id', "groupId") ) - FROM BountyGroup - WHERE bountyId = b.id + FROM "BountyGroup" + WHERE "bountyId" = b.id ), - JSON_ARRAY() - ) AS \`groups\` + '[]'::jsonb + ) AS "groups" - FROM Bounty b - LEFT JOIN Workflow wf ON wf.id = b.workflowId - WHERE b.id = ${bountyId} AND b.programId = ${programId} + FROM "Bounty" b + LEFT JOIN "Workflow" wf ON wf.id = b."workflowId" + WHERE b.id = ${bountyId} AND b."programId" = ${programId} LIMIT 1 `) satisfies Array; diff --git a/apps/web/lib/customers/api/customer-count-where.ts b/apps/web/lib/customers/api/customer-count-where.ts index 6c8c18fcf63..32c26f30f2d 100644 --- a/apps/web/lib/customers/api/customer-count-where.ts +++ b/apps/web/lib/customers/api/customer-count-where.ts @@ -36,8 +36,20 @@ export function buildCustomerCountWhere(filters: CustomerCountFilters) { ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), // only filter by country if not grouping by country diff --git a/apps/web/lib/customers/api/get-customers.ts b/apps/web/lib/customers/api/get-customers.ts index 58b811c9b20..51ae93c249f 100644 --- a/apps/web/lib/customers/api/get-customers.ts +++ b/apps/web/lib/customers/api/get-customers.ts @@ -70,8 +70,20 @@ export async function getCustomers(filters: GetCustomersInput) { ? search.includes("@") ? { email: search } : { - email: { search: sanitizeFullTextSearch(search) }, - name: { search: sanitizeFullTextSearch(search) }, + OR: [ + { + email: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + { + name: { + contains: sanitizeFullTextSearch(search), + mode: "insensitive", + }, + }, + ], } : {}), ...(country && { diff --git a/apps/web/lib/integrations/slack/commands.ts b/apps/web/lib/integrations/slack/commands.ts index 709920e95db..313d874906b 100644 --- a/apps/web/lib/integrations/slack/commands.ts +++ b/apps/web/lib/integrations/slack/commands.ts @@ -40,7 +40,7 @@ export const handleSlashCommand = async (req: Request) => { where: { integrationId: SLACK_INTEGRATION_ID, credentials: { - path: "$.team.id", + path: ["team", "id"], equals: data.team_id, }, }, diff --git a/apps/web/lib/jackson.ts b/apps/web/lib/jackson.ts index 9f7416a12da..de6a3ae72bc 100644 --- a/apps/web/lib/jackson.ts +++ b/apps/web/lib/jackson.ts @@ -5,7 +5,7 @@ import type { JacksonOption, } from "@boxyhq/saml-jackson"; import samlJackson from "@boxyhq/saml-jackson"; -import { APP_DOMAIN_WITH_NGROK } from "@dub/utils"; +import { APP_DOMAIN_WITH_NGROK } from "@dub/utils/src/constants"; export const samlAudience = "https://saml.dub.co"; @@ -20,8 +20,8 @@ const opts: JacksonOption = { : "/api/auth/saml/callback", samlAudience, db: { - engine: "planetscale", - type: "mysql", + engine: "sql", + type: "postgres", url: process.env.DATABASE_URL as string, ssl: { rejectUnauthorized: false, diff --git a/apps/web/lib/middleware/link.ts b/apps/web/lib/middleware/link.ts index 067028b2a30..83f8a3c2083 100644 --- a/apps/web/lib/middleware/link.ts +++ b/apps/web/lib/middleware/link.ts @@ -21,8 +21,8 @@ import { import { linkCache } from "../api/links/cache"; import { isCaseSensitiveDomain } from "../api/links/case-sensitivity"; import { recordClickCache } from "../api/links/record-click-cache"; -import { getLinkViaEdge } from "../planetscale"; -import { getPartnerEnrollmentInfo } from "../planetscale/get-partner-enrollment-info"; +import { getLinkViaEdge } from "../postgres"; +import { getPartnerEnrollmentInfo } from "../postgres/get-partner-enrollment-info"; import { cacheDeepLinkClickData } from "./utils/cache-deeplink-click-data"; import { crawlBitly } from "./utils/crawl-bitly"; import { createResponseWithCookies } from "./utils/create-response-with-cookies"; diff --git a/apps/web/lib/middleware/utils/get-workspace-product.ts b/apps/web/lib/middleware/utils/get-workspace-product.ts index 1f56fe8a486..9f6f81a70b3 100644 --- a/apps/web/lib/middleware/utils/get-workspace-product.ts +++ b/apps/web/lib/middleware/utils/get-workspace-product.ts @@ -1,4 +1,4 @@ -import { conn } from "@/lib/planetscale/connection"; +import { conn } from "@/lib/postgres/connection"; import { WorkspaceProps } from "@/lib/types"; import { redis } from "@/lib/upstash"; import { after } from "next/server"; @@ -13,7 +13,7 @@ export const getWorkspaceProduct = async (workspaceSlug: string) => { } const { rows } = - (await conn.execute(`SELECT * FROM Project WHERE slug = ?`, [ + (await conn.execute(`SELECT * FROM "Project" WHERE "slug" = ?`, [ workspaceSlug, ])) || {}; diff --git a/apps/web/lib/planetscale/connection.ts b/apps/web/lib/planetscale/connection.ts deleted file mode 100644 index a1daafb3815..00000000000 --- a/apps/web/lib/planetscale/connection.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { connect } from "@planetscale/database"; - -export const conn = connect({ - url: process.env.PLANETSCALE_DATABASE_URL || process.env.DATABASE_URL, -}); diff --git a/apps/web/lib/planetscale/check-if-key-exists.ts b/apps/web/lib/postgres/check-if-key-exists.ts similarity index 86% rename from apps/web/lib/planetscale/check-if-key-exists.ts rename to apps/web/lib/postgres/check-if-key-exists.ts index 9069c7abee1..fc4b56ef8c5 100644 --- a/apps/web/lib/planetscale/check-if-key-exists.ts +++ b/apps/web/lib/postgres/check-if-key-exists.ts @@ -17,12 +17,12 @@ export const checkIfKeyExists = async ({ ? // for case sensitive domains, we need to encode the key encodeKey(key) : // for non-case sensitive domains, we need to make sure that the key is always URI-decoded + punycode-encoded - // (cause that's how we store it in MySQL) + // (cause that's how we store it) punyEncode(decodeURIComponent(key)); const { rows } = (await conn.execute( - "SELECT 1 FROM Link WHERE domain = ? AND `key` = ? LIMIT 1", + `SELECT 1 FROM "Link" WHERE "domain" = ? AND "key" = ? LIMIT 1`, [domain, keyToQuery], )) || {}; diff --git a/apps/web/lib/planetscale/check-if-user-exists.ts b/apps/web/lib/postgres/check-if-user-exists.ts similarity index 63% rename from apps/web/lib/planetscale/check-if-user-exists.ts rename to apps/web/lib/postgres/check-if-user-exists.ts index f9c4a25dfc6..c3d886a23f5 100644 --- a/apps/web/lib/planetscale/check-if-user-exists.ts +++ b/apps/web/lib/postgres/check-if-user-exists.ts @@ -2,8 +2,9 @@ import { conn } from "./connection"; export const checkIfUserExists = async (userId: string) => { const { rows } = - (await conn.execute("SELECT 1 FROM User WHERE id = ? LIMIT 1", [userId])) || - {}; + (await conn.execute(`SELECT 1 FROM "User" WHERE "id" = ? LIMIT 1`, [ + userId, + ])) || {}; return rows && Array.isArray(rows) && rows.length > 0; }; diff --git a/apps/web/lib/postgres/connection.ts b/apps/web/lib/postgres/connection.ts new file mode 100644 index 00000000000..2dfe4b85626 --- /dev/null +++ b/apps/web/lib/postgres/connection.ts @@ -0,0 +1,46 @@ +import { Pool, type QueryResultRow } from "pg"; + +declare global { + // eslint-disable-next-line no-var + var pgPool: Pool | undefined; +} + +const getPool = () => { + if (!process.env.DATABASE_URL) { + throw new Error("DATABASE_URL is required to connect to PostgreSQL."); + } + + if (!global.pgPool) { + global.pgPool = new Pool({ + connectionString: process.env.DATABASE_URL, + max: Number(process.env.POSTGRES_POOL_MAX ?? 10), + ssl: + process.env.POSTGRES_SSL === "true" + ? { rejectUnauthorized: false } + : undefined, + }); + } + + return global.pgPool; +}; + +const replacePlaceholders = (query: string) => { + let index = 0; + return query.replace(/\?/g, () => `$${++index}`); +}; + +export const conn = { + async execute( + query: string, + params: unknown[] = [], + ) { + const result = await getPool().query(replacePlaceholders(query), params); + + return { + rows: result.rows, + fields: result.fields, + rowsAffected: result.rowCount, + rowCount: result.rowCount, + }; + }, +}; diff --git a/apps/web/lib/planetscale/get-domain-via-edge.ts b/apps/web/lib/postgres/get-domain-via-edge.ts similarity index 92% rename from apps/web/lib/planetscale/get-domain-via-edge.ts rename to apps/web/lib/postgres/get-domain-via-edge.ts index fd1390bd09b..bc34a22cead 100644 --- a/apps/web/lib/planetscale/get-domain-via-edge.ts +++ b/apps/web/lib/postgres/get-domain-via-edge.ts @@ -15,7 +15,7 @@ export const getDomainViaEdge = async (domain: string) => { const { rows } = (await conn.execute( - "SELECT * FROM Domain WHERE slug = ?", + `SELECT * FROM "Domain" WHERE "slug" = ?`, [domain], )) || {}; diff --git a/apps/web/lib/planetscale/get-link-via-edge.ts b/apps/web/lib/postgres/get-link-via-edge.ts similarity index 90% rename from apps/web/lib/planetscale/get-link-via-edge.ts rename to apps/web/lib/postgres/get-link-via-edge.ts index 9ec1bcdff99..b85bf527a30 100644 --- a/apps/web/lib/planetscale/get-link-via-edge.ts +++ b/apps/web/lib/postgres/get-link-via-edge.ts @@ -19,15 +19,15 @@ const getLinkViaEdgeHelper = async ({ ? // for case sensitive domains, we need to encode the key encodeKey(key) : // for non-case sensitive domains, we need to make sure that the key is always URI-decoded + punycode-encoded - // (cause that's how we store it in MySQL) + // (cause that's how we store it) punyEncode(decodeURIComponent(key)); const { rows } = (await conn.execute( - `SELECT Link.*, LinkWebhook.webhookId - FROM Link - LEFT JOIN LinkWebhook ON Link.id = LinkWebhook.linkId - WHERE Link.domain = ? AND Link.\`key\` = ?`, + `SELECT l.*, lw."webhookId" AS "webhookId" + FROM "Link" l + LEFT JOIN "LinkWebhook" lw ON l.id = lw."linkId" + WHERE l."domain" = ? AND l."key" = ?`, [domain, keyToQuery], )) || {}; diff --git a/apps/web/lib/planetscale/get-link-with-partner.ts b/apps/web/lib/postgres/get-link-with-partner.ts similarity index 66% rename from apps/web/lib/planetscale/get-link-with-partner.ts rename to apps/web/lib/postgres/get-link-with-partner.ts index 531fb0ea355..dfd17286ace 100644 --- a/apps/web/lib/planetscale/get-link-with-partner.ts +++ b/apps/web/lib/postgres/get-link-with-partner.ts @@ -37,24 +37,24 @@ export const getLinkWithPartner = async ({ const { rows } = (await conn.execute( `SELECT - Link.*, - Partner.id as partnerId, - Partner.name as partnerName, - Partner.image as partnerImage, - ProgramEnrollment.groupId as groupId, - ProgramEnrollment.tenantId as tenantId, - PartnerDiscount.id as discountId, - PartnerDiscount.amount as discountAmount, - PartnerDiscount.type as discountType, - PartnerDiscount.maxDuration as discountMaxDuration, - PartnerDiscount.couponId as discountCouponId, - PartnerDiscount.couponTestId as discountCouponTestId - FROM Link - LEFT JOIN ProgramEnrollment ON ProgramEnrollment.programId = Link.programId AND ProgramEnrollment.partnerId = Link.partnerId - LEFT JOIN Partner ON Partner.id = ProgramEnrollment.partnerId - LEFT JOIN Discount PartnerDiscount ON ProgramEnrollment.discountId = PartnerDiscount.id - LEFT JOIN Program ON Program.id = Link.programId - WHERE Link.domain = ? AND Link.key = ?`, + l.*, + p.id as "partnerId", + p.name as "partnerName", + p.image as "partnerImage", + pe."groupId" as "groupId", + pe."tenantId" as "tenantId", + d.id as "discountId", + d.amount as "discountAmount", + d.type as "discountType", + d."maxDuration" as "discountMaxDuration", + d."couponId" as "discountCouponId", + d."couponTestId" as "discountCouponTestId" + FROM "Link" l + LEFT JOIN "ProgramEnrollment" pe ON pe."programId" = l."programId" AND pe."partnerId" = l."partnerId" + LEFT JOIN "Partner" p ON p.id = pe."partnerId" + LEFT JOIN "Discount" d ON pe."discountId" = d.id + LEFT JOIN "Program" pg ON pg.id = l."programId" + WHERE l."domain" = ? AND l."key" = ?`, [domain, keyToQuery], )) || {}; diff --git a/apps/web/lib/planetscale/get-partner-enrollment-info.ts b/apps/web/lib/postgres/get-partner-enrollment-info.ts similarity index 66% rename from apps/web/lib/planetscale/get-partner-enrollment-info.ts rename to apps/web/lib/postgres/get-partner-enrollment-info.ts index 4cd3e6d5d93..58e034a87fe 100644 --- a/apps/web/lib/planetscale/get-partner-enrollment-info.ts +++ b/apps/web/lib/postgres/get-partner-enrollment-info.ts @@ -12,7 +12,7 @@ interface QueryResult { couponTestId: string | null; groupId: string | null; tenantId: string | null; - /** JSON array from JSON_ARRAYAGG; driver may return a string or parsed array */ + /** JSON array from json_agg; driver may return a string or parsed array */ partnerTagIds: string | string[] | null; } @@ -55,42 +55,42 @@ export const getPartnerEnrollmentInfo = async ({ const { rows } = await conn.execute( `SELECT - Partner.id, - Partner.name, - Partner.image, - Discount.id AS discountId, - Discount.amount, - Discount.type, - Discount.maxDuration, - Discount.couponId, - Discount.couponTestId, - ProgramEnrollment.groupId, - ProgramEnrollment.tenantId, - tagAgg.partnerTagIds - FROM - ProgramEnrollment - LEFT JOIN Partner ON Partner.id = ProgramEnrollment.partnerId - LEFT JOIN Discount ON Discount.id = ProgramEnrollment.discountId + p.id, + p.name, + p.image, + d.id AS "discountId", + d.amount, + d.type, + d."maxDuration", + d."couponId", + d."couponTestId", + pe."groupId", + pe."tenantId", + tagAgg."partnerTagIds" + FROM "ProgramEnrollment" pe + LEFT JOIN "Partner" p ON p.id = pe."partnerId" + LEFT JOIN "Discount" d ON d.id = pe."discountId" LEFT JOIN ( SELECT - programId, - partnerId, - JSON_ARRAYAGG(partnerTagId) AS partnerTagIds + "programId", + "partnerId", + json_agg("partnerTagId") AS "partnerTagIds" FROM ( SELECT DISTINCT - programId, - partnerId, - partnerTagId - FROM ProgramPartnerTag - WHERE programId = ? AND partnerId = ? - ) AS distinct_program_partner_tags - GROUP BY programId, partnerId + "programId", + "partnerId", + "partnerTagId" + FROM "ProgramPartnerTag" + WHERE "programId" = ? AND "partnerId" = ? + ) distinct_program_partner_tags + GROUP BY "programId", "partnerId" ) AS tagAgg - ON tagAgg.programId = ProgramEnrollment.programId - AND tagAgg.partnerId = ProgramEnrollment.partnerId + ON tagAgg."programId" = pe."programId" + AND tagAgg."partnerId" = pe."partnerId" WHERE - ProgramEnrollment.partnerId = ? - AND ProgramEnrollment.programId = ?`, + pe."partnerId" = ? + AND pe."programId" = ? + LIMIT 1`, [programId, partnerId, partnerId, programId], ); diff --git a/apps/web/lib/planetscale/get-random-key.ts b/apps/web/lib/postgres/get-random-key.ts similarity index 100% rename from apps/web/lib/planetscale/get-random-key.ts rename to apps/web/lib/postgres/get-random-key.ts diff --git a/apps/web/lib/planetscale/get-shortlink-via-edge.ts b/apps/web/lib/postgres/get-shortlink-via-edge.ts similarity index 80% rename from apps/web/lib/planetscale/get-shortlink-via-edge.ts rename to apps/web/lib/postgres/get-shortlink-via-edge.ts index 870326dca64..68ceac54fb9 100644 --- a/apps/web/lib/planetscale/get-shortlink-via-edge.ts +++ b/apps/web/lib/postgres/get-shortlink-via-edge.ts @@ -3,7 +3,7 @@ import { EdgeLinkProps } from "./types"; export const getShortLinkViaEdge = async (shortLink: string) => { const { rows } = - (await conn.execute("SELECT * FROM Link WHERE shortLink = ?", [ + (await conn.execute(`SELECT * FROM "Link" WHERE "shortLink" = ?`, [ shortLink, ])) || {}; diff --git a/apps/web/lib/planetscale/get-workspace-via-edge.ts b/apps/web/lib/postgres/get-workspace-via-edge.ts similarity index 77% rename from apps/web/lib/planetscale/get-workspace-via-edge.ts rename to apps/web/lib/postgres/get-workspace-via-edge.ts index cdda2220f8a..af6af84986a 100644 --- a/apps/web/lib/planetscale/get-workspace-via-edge.ts +++ b/apps/web/lib/postgres/get-workspace-via-edge.ts @@ -11,19 +11,19 @@ export const getWorkspaceViaEdge = async ({ }) => { const query = includeDomains ? ` - SELECT + SELECT w.*, - d.slug - FROM Project w - LEFT JOIN Domain d ON w.id = d.projectId + d.slug as "domainSlug" + FROM "Project" w + LEFT JOIN "Domain" d ON w.id = d."projectId" WHERE w.id = ? LIMIT 100 ` : ` - SELECT - w.* - FROM Project w - WHERE w.id = ? + SELECT + w.* + FROM "Project" w + WHERE w.id = ? LIMIT 1 `; @@ -44,15 +44,15 @@ export const getWorkspaceViaEdge = async ({ // Process all rows to collect domains rows.forEach((row: any) => { - if (row.slug) { + if (row.domainSlug) { domains.push({ - slug: row.slug, + slug: row.domainSlug, }); } }); // Remove domain fields from workspace object - const { slug, ...cleanWorkspaceData } = workspaceData; + const { domainSlug, ...cleanWorkspaceData } = workspaceData; return { ...cleanWorkspaceData, diff --git a/apps/web/lib/planetscale/granularity.ts b/apps/web/lib/postgres/granularity.ts similarity index 68% rename from apps/web/lib/planetscale/granularity.ts rename to apps/web/lib/postgres/granularity.ts index 11c4e6367ee..bbc6d4b0677 100644 --- a/apps/web/lib/planetscale/granularity.ts +++ b/apps/web/lib/postgres/granularity.ts @@ -1,3 +1,4 @@ +import { Prisma } from "@dub/prisma/client"; import { addDays, addHours, @@ -19,27 +20,38 @@ export const sqlGranularityMap: Record< } > = { month: { - dateFormat: "%Y-%m", + dateFormat: "YYYY-MM", dateIncrement: (dt) => addMonths(dt, 1), startFunction: (dt) => startOfMonth(dt), formatString: "yyyy-MM", }, day: { - dateFormat: "%Y-%m-%d", + dateFormat: "YYYY-MM-DD", dateIncrement: (dt) => addDays(dt, 1), startFunction: (dt) => startOfDay(dt), formatString: "yyyy-MM-dd", }, hour: { - dateFormat: "%Y-%m-%d %H:00", + dateFormat: "YYYY-MM-DD HH24:00", dateIncrement: (dt) => addHours(dt, 1), startFunction: (dt) => startOfHour(dt), formatString: "yyyy-MM-dd HH:00", }, minute: { - dateFormat: "%Y-%m-%d %H:%i", + dateFormat: "YYYY-MM-DD HH24:MI", dateIncrement: (dt) => addMinutes(dt, 1), startFunction: (dt) => startOfMinute(dt), formatString: "yyyy-MM-dd HH:mm", }, } as const; + +export const pgDateBucket = ({ + column, + timezone = "UTC", + dateFormat, +}: { + column: Prisma.Sql; + timezone?: string; + dateFormat: string; +}) => + Prisma.sql`to_char(${column} AT TIME ZONE 'UTC' AT TIME ZONE ${timezone}, ${dateFormat})`; diff --git a/apps/web/lib/planetscale/index.ts b/apps/web/lib/postgres/index.ts similarity index 100% rename from apps/web/lib/planetscale/index.ts rename to apps/web/lib/postgres/index.ts diff --git a/apps/web/lib/planetscale/types.ts b/apps/web/lib/postgres/types.ts similarity index 100% rename from apps/web/lib/planetscale/types.ts rename to apps/web/lib/postgres/types.ts diff --git a/apps/web/lib/tinybird/record-click.ts b/apps/web/lib/tinybird/record-click.ts index c1612cc2430..6a40c56f62b 100644 --- a/apps/web/lib/tinybird/record-click.ts +++ b/apps/web/lib/tinybird/record-click.ts @@ -13,7 +13,7 @@ import { ExpandedLink, transformLink } from "../api/links/utils/transform-link"; import { detectBot } from "../middleware/utils/detect-bot"; import { detectQr } from "../middleware/utils/detect-qr"; import { getIdentityHash } from "../middleware/utils/get-identity-hash"; -import { conn } from "../planetscale"; +import { conn } from "../postgres"; import { WorkspaceProps } from "../types"; import { redis } from "../upstash"; import { publishPartnerActivityEvent } from "../upstash/redis-streams/partner-activity"; @@ -102,7 +102,7 @@ export async function recordClick({ } } catch (error) { console.error(`[recordClickCache error]: ${error}`); - // if redis fails, return null so we don't overwhelm TB/MySQL + // if redis fails, return null so we don't overwhelm TB/Postgres return null; } } @@ -192,9 +192,11 @@ export async function recordClick({ recordClickCache.set({ domain, key, identityHash, clickId }), // increment the click count for the link (based on their ID) - // we have to use planetscale connection directly (not prismaEdge) because of connection pooling + // use a direct Postgres connection here because of connection pooling conn.execute( - "UPDATE Link SET clicks = clicks + 1, lastClicked = NOW() WHERE id = ?", + `UPDATE "Link" + SET clicks = clicks + 1, "lastClicked" = NOW() + WHERE id = ?`, [linkId], ), // if the link is associated with a workspace + has a destination URL @@ -208,7 +210,10 @@ export async function recordClick({ }).catch(() => { // Fallback on writing directly to the database return conn.execute( - "UPDATE Project p JOIN Link l ON p.id = l.projectId SET p.usage = p.usage + 1, p.totalClicks = p.totalClicks + 1 WHERE l.id = ?", + `UPDATE "Project" p + SET usage = p.usage + 1, "totalClicks" = p."totalClicks" + 1 + FROM "Link" l + WHERE p.id = l."projectId" AND l.id = ?`, [linkId], ); }), @@ -223,7 +228,9 @@ export async function recordClick({ }).catch(() => { // Fallback on writing directly to the database return conn.execute( - "UPDATE ProgramEnrollment SET totalClicks = totalClicks + 1 WHERE programId = ? AND partnerId = ?", + `UPDATE "ProgramEnrollment" + SET "totalClicks" = "totalClicks" + 1 + WHERE "programId" = ? AND "partnerId" = ?`, [programId, partnerId], ); }), @@ -265,7 +272,7 @@ export async function recordClick({ const hasWebhooks = webhookIds && webhookIds.length > 0; if (workspaceId && hasWebhooks) { const workspaceRows = await conn.execute( - "SELECT usage, usageLimit FROM Project WHERE id = ? LIMIT 1", + `SELECT usage, "usageLimit" FROM "Project" WHERE id = ? LIMIT 1`, [workspaceId], ); @@ -326,15 +333,18 @@ async function sendLinkClickWebhooks({ ` SELECT l.*, - JSON_ARRAYAGG( - IF(t.id IS NOT NULL, - JSON_OBJECT('tag', JSON_OBJECT('id', t.id, 'name', t.name, 'color', t.color)), - NULL - ) + COALESCE( + jsonb_agg( + jsonb_build_object( + 'tag', + jsonb_build_object('id', t.id, 'name', t.name, 'color', t.color) + ) + ) FILTER (WHERE t.id IS NOT NULL), + '[]'::jsonb ) as tags - FROM Link l - LEFT JOIN LinkTag lt ON l.id = lt.linkId - LEFT JOIN Tag t ON lt.tagId = t.id + FROM "Link" l + LEFT JOIN "LinkTag" lt ON l.id = lt."linkId" + LEFT JOIN "Tag" t ON lt."tagId" = t.id WHERE l.id = ? GROUP BY l.id `, @@ -342,7 +352,7 @@ async function sendLinkClickWebhooks({ ) .then((res) => { const row = res.rows[0] as any; - // Handle case where there are no tags (JSON_ARRAYAGG returns [null]) + // Handle legacy/null aggregation responses defensively. row.tags = row.tags?.[0] === null ? [] : row.tags; return row; }); diff --git a/apps/web/lib/upstash/redis-streams/workspace-links-usage.ts b/apps/web/lib/upstash/redis-streams/workspace-links-usage.ts index d7c029d5f87..47b31d35266 100644 --- a/apps/web/lib/upstash/redis-streams/workspace-links-usage.ts +++ b/apps/web/lib/upstash/redis-streams/workspace-links-usage.ts @@ -1,4 +1,4 @@ -import { conn } from "@/lib/planetscale"; +import { conn } from "@/lib/postgres"; import { redis } from "../redis"; import { RedisStream } from "./client"; @@ -33,7 +33,9 @@ export const publishWorkspaceLinksUsageEvent = async ( ); // fallback on writing directly to the database return await conn.execute( - "UPDATE Project SET linksUsage = linksUsage + ?, totalLinks = totalLinks + ? WHERE id = ?", + `UPDATE "Project" + SET "linksUsage" = "linksUsage" + ?, "totalLinks" = "totalLinks" + ? + WHERE id = ?`, [linksCount, linksCount, workspaceId], ); } diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts index 656c9c63544..a60e91c6aab 100644 --- a/apps/web/lib/zod/schemas/partners.ts +++ b/apps/web/lib/zod/schemas/partners.ts @@ -1,4 +1,4 @@ -import { processKey } from "@/lib/api/links/utils"; +import { processKey } from "@/lib/api/links/utils/process-key"; import { MAX_PARTNERS_INVITES_PER_REQUEST } from "@/lib/constants/program"; import { IdentityVerificationStatus, diff --git a/apps/web/package.json b/apps/web/package.json index 3ec800cab80..fa5f58e11b9 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -40,7 +40,6 @@ "@mendable/firecrawl-js": "^1.29.1", "@next-auth/prisma-adapter": "^1.0.7", "@number-flow/react": "^0.4.1", - "@planetscale/database": "^1.18.0", "@prisma/nextjs-monorepo-workaround-plugin": "^6.19.1", "@radix-ui/react-hover-card": "^1.1.1", "@react-pdf/renderer": "^4.1.5", @@ -114,6 +113,7 @@ "openapi-types": "^12.1.3", "openapi3-ts": "^4.2.1", "openid-client": "^6.8.0", + "pg": "8.16.0", "react": "19.1.3", "react-colorful": "^5.6.1", "react-dom": "19.1.3", @@ -149,6 +149,7 @@ "@types/luxon": "^3.7.1", "@types/ms": "^0.7.31", "@types/node": "18.11.9", + "@types/pg": "8.11.11", "@types/react": "19.1.14", "@types/react-dom": "19.1.9", "@types/react-highlight-words": "^0.16.4", diff --git a/apps/web/scripts/dev/seed.ts b/apps/web/scripts/dev/seed.ts index 31735a349d4..dc153367cee 100644 --- a/apps/web/scripts/dev/seed.ts +++ b/apps/web/scripts/dev/seed.ts @@ -521,8 +521,8 @@ const truncate = async () => { const tableName = tables[i]; try { process.stdout.write(`\r[${i + 1}/${total}] Truncating ${tableName}...`); - // Use TRUNCATE for each table separately (MySQL/PlanetScale syntax) - await prisma.$executeRawUnsafe(`TRUNCATE TABLE \`${tableName}\`;`); + // Use TRUNCATE for each table separately. + await prisma.$executeRawUnsafe(`TRUNCATE TABLE "${tableName}";`); } catch (error: any) { errors.push( `${tableName}: ${error.message || error.code || "Unknown error"}`, diff --git a/apps/web/scripts/misc/cleanup-fraud-events.ts b/apps/web/scripts/misc/cleanup-fraud-events.ts index 975ad17acb6..bfa6efbf552 100644 --- a/apps/web/scripts/misc/cleanup-fraud-events.ts +++ b/apps/web/scripts/misc/cleanup-fraud-events.ts @@ -10,7 +10,7 @@ async function main() { resolvedAt: null, }, metadata: { - path: "$.matchType", + path: ["matchType"], equals: "historicalDomainMatch", }, customer: { diff --git a/apps/web/scripts/misc/cleanup-generic-email-fraud-events.ts b/apps/web/scripts/misc/cleanup-generic-email-fraud-events.ts index df8bb695cbd..e4c31751d08 100644 --- a/apps/web/scripts/misc/cleanup-generic-email-fraud-events.ts +++ b/apps/web/scripts/misc/cleanup-generic-email-fraud-events.ts @@ -13,13 +13,13 @@ async function main() { OR: [ { metadata: { - path: "$.matchType", + path: ["matchType"], equals: "domainMatch", }, }, { metadata: { - path: "$.matchType", + path: ["matchType"], equals: "historicalDomainMatch", }, }, diff --git a/apps/web/scripts/partners/delete-partner-profile.ts b/apps/web/scripts/partners/delete-partner-profile.ts index de0dc2f9177..4173898d503 100644 --- a/apps/web/scripts/partners/delete-partner-profile.ts +++ b/apps/web/scripts/partners/delete-partner-profile.ts @@ -1,6 +1,6 @@ import { prisma } from "@dub/prisma"; import "dotenv-flow/config"; -import { conn } from "../../lib/planetscale"; +import { conn } from "../../lib/postgres"; import { stripeConnectClient } from "../stripe/connect-client"; async function main() { @@ -53,7 +53,7 @@ async function main() { console.log("Deleted program enrollments", deletedProgramEnrollments); // using conn.execute here since Prisma is throwing a weird error - const res = await conn.execute(`DELETE FROM Partner WHERE id = ?`, [ + const res = await conn.execute(`DELETE FROM "Partner" WHERE id = ?`, [ partner.id, ]); console.log(JSON.stringify(res, null, 2)); diff --git a/docs/postgres-port-workarounds.md b/docs/postgres-port-workarounds.md new file mode 100644 index 00000000000..668f8e80a9d --- /dev/null +++ b/docs/postgres-port-workarounds.md @@ -0,0 +1,106 @@ +# PostgreSQL Port Workarounds + +This branch ports the project from PlanetScale / MySQL Vitess to PostgreSQL 16 +while keeping Prisma 6.19.x. The items below track places where behavior could +not be carried over exactly as-is, and the compatible alternative used instead. + +## Prisma Schema And Indexes + +- MySQL `@db.LongText` fields were converted to PostgreSQL `@db.Text`. +- MySQL `@@fulltext` indexes were removed because Prisma 6.19 does not expose + a provider-portable full-text abstraction for the existing MySQL indexes. +- MySQL prefix indexes such as `url(length: 500)` were removed. PostgreSQL does + not support MySQL-style prefix indexes through Prisma schema attributes. +- PostgreSQL-specific search indexes now live in + `packages/prisma/postgres-postdeploy.sql`, using `pg_trgm` and GIN indexes. + This script must run after `prisma db push` or production DDL application. + +## Search Semantics + +- Prisma MySQL full-text `search` filters were replaced with + case-insensitive `contains` filters. +- `sanitizeFullTextSearch` remains as a compatibility helper, but its output is + now used for substring-style matching rather than MySQL full-text query syntax. +- The trigram indexes are intended to keep these lookups practical on + PostgreSQL, but ranking/tokenization semantics are not identical to MySQL + full-text search. + +## Raw SQL + +- MySQL JSON/date/string functions were rewritten to PostgreSQL equivalents: + `jsonb_*`, `->`, `->>`, `jsonb_array_length`, `string_agg`, `to_char`, and + `AT TIME ZONE`. +- MySQL `UPDATE ... JOIN`, `FORCE INDEX`, backtick aliases, and `LIKE` patterns + that needed case-insensitive behavior were rewritten for PostgreSQL. +- The former PlanetScale query helper is now `apps/web/lib/postgres`. It keeps + the `execute(query, params)` shape and translates `?` placeholders to + PostgreSQL positional placeholders. + +## Runtime + +- The old PlanetScale HTTP driver could run in Edge-like contexts. The + PostgreSQL `pg` driver is Node-only, so DB-backed routes/helpers were moved to + Node runtime where required. +- Some helper names still include `ViaEdge` for API compatibility, but they now + access PostgreSQL from Node runtime. +- Edge routes that only needed non-DB code were kept on Edge and adjusted to + avoid importing barrels that pull in PostgreSQL code. + +## Backups + +- The PlanetScale backup API flow was removed. +- `POSTGRES_BACKUP_WEBHOOK_URL` can be set for the backup cron to trigger an + external PostgreSQL backup job. Without it, the cron logs that PostgreSQL + backups are managed externally. + +## Validation Notes + +- `prisma db push` and `postdeploy:postgres` were validated against a fresh + `postgres:16` Docker container. +- The development seed and Playwright seed were run against that container. +- Smoke queries covered direct SQL, Prisma raw queries, and the PostgreSQL + helper layer. +- `pnpm turbo build --filter=web` compiles and passes TypeScript, then stops + during Next page-data collection on an unrelated existing + `@dub/utils` `optimizePackageImports` virtual module issue. + +## Prisma Next Hybrid Trial + +- Prisma Next is present as a parallel authoring and validation path only. + Production `@dub/prisma`, `@dub/prisma/client`, and Prisma 6.19.x Client + behavior remain authoritative for the app. +- The vendored `@prisma-next/*` tarballs were packed from + `~/work/prisma/prisma-next-clean` on branch + `feat/created-updated-at-authoring` at commit + `93be243beea17c8f2a846445b6dd42ba35b7a30b`. +- `packages/prisma/schema/contract.prisma` is the Prisma Next PSL contract. + `contract.json` and `contract.d.ts` are emitted and committed next to it. +- Prisma Next cannot express Prisma `relationMode = "prisma"` yet, so + generated validation DDL includes foreign keys that the Prisma 6 schema does + not create. These foreign keys and their derived helper indexes are + classified as expected DDL differences. +- Prisma Next PSL does not preserve index sort direction today. Indexes that + differ only by `sort: Asc` or `sort: Desc` are classified as expected DDL + differences. +- This Prisma Next build still rejects Dub's Prisma 6 no-id tables through the + PSL authoring path. The Next contract adds validation-only synthetic `id` + fields for those models while preserving their original unique constraints. +- `temporal.updatedAt()` is the Prisma Next authoring form for Prisma 6 + `@updatedAt`, but this build lowers it to PostgreSQL `timestamptz`. Dub's + Prisma 6 schema uses `timestamp(3)` for these columns, so the comparer tracks + that storage-type drift separately. +- Current `next:ddl:compare` output is 296 expected differences and 0 + unexpected differences: 168 Prisma Next foreign keys, 66 FK-derived helper + indexes, 18 synthetic-id differences, and 44 `updatedAt` timestamp-type + differences. +- `next:emit` runs a post-emit normalizer for current Prisma Next JSON + artifacts where `false` literal defaults and native JSON named-type + parameters are accepted by the emitter but rejected by runtime validation. +- Prisma Next accepts `@db.Timestamp(0)` during contract emission but rejects + precision `0` while applying DDL. The Next contract uses unparameterized + PostgreSQL `timestamp` for those validation-only fields. +- Prisma Next DDL is validation-only in this phase. It is not the + authoritative migration source for Dub. +- `temporal.updatedAt()` is intentionally part of the Prisma Next contract. It + is validated as an application-side create/update mutation default; the + remaining workaround is the PostgreSQL storage type it currently selects. diff --git a/docs/prisma-next-date-value-expectations.md b/docs/prisma-next-date-value-expectations.md new file mode 100644 index 00000000000..3453d23fd9c --- /dev/null +++ b/docs/prisma-next-date-value-expectations.md @@ -0,0 +1,217 @@ +# Prisma Next Date Value Expectations + +This document describes how I would expect Prisma Next to handle date values +when matching Prisma 6 behavior on PostgreSQL. It is based on Prisma 6's +observable JavaScript API, not on raw `pg` driver behavior alone. + +The short version: typed `DateTime` fields should round-trip as JavaScript +`Date` instances, and the same database row should produce the same +`Date#toISOString()` value in Prisma 6 and Prisma Next. + +## Scope + +This applies to Prisma ORM reads and writes for PostgreSQL `DateTime` columns, +including Dub's Prisma Next named type: + +```prisma +types { + Timestamp3 = DateTime @db.Timestamp(3) +} +``` + +and the Prisma 6 equivalent: + +```prisma +createdAt DateTime @default(now()) @db.Timestamp(3) +updatedAt DateTime @updatedAt @db.Timestamp(3) +``` + +It also applies to date values used in `where` filters, ordering, explicit +mutation data, `@default(now())`, and Prisma Next `temporal.updatedAt()`. + +It does not imply that JSON string values should become `Date` instances. If a +date-like value is stored inside a JSON column, it remains JSON data unless the +caller parses it. + +## Compatibility Target + +For the same schema, database value, input value, and runtime operation, Prisma +Next should match Prisma 6 at the application boundary: + +- A selected `DateTime` field returns a JavaScript `Date`. +- `value instanceof Date` is true for ORM result values. +- `value.toISOString()` matches Prisma 6 for the same row. +- Explicit `Date` inputs preserve the same instant Prisma 6 would preserve. +- Date filter bounds match the same rows Prisma 6 would match. +- Null optional date fields remain `null`. + +The comparison target is Prisma Client's observable result, not the textual form +PostgreSQL happens to display and not the intermediate representation a driver +uses before decoding a row. + +## PostgreSQL Type Semantics + +PostgreSQL has two relevant timestamp families: + +- `timestamp with time zone`, usually written `timestamptz`, represents an + instant. +- `timestamp without time zone`, usually written `timestamp`, stores date-time + fields without a zone. + +Dub's contract uses many `timestamp(3)` columns. These are `timestamp without +time zone` columns. They do not store an offset, but Prisma 6 still exposes them +as JavaScript `Date` values. Prisma Next therefore needs an explicit +compatibility rule for how to encode and decode those values. + +That rule must not accidentally depend on the process timezone, the local +machine timezone, or the PostgreSQL session timezone in a way that makes Prisma +Next shift a value that Prisma 6 would not shift. + +## Read Expectations + +When reading a typed `DateTime` column through the ORM, Prisma Next should return +a `Date` instance. + +For an existing row, these values should match: + +```ts +const prisma6Value = await prisma.model.findUnique(...); +const prismaNextValue = await db.orm.Model.where(...).select(...).first(); + +prisma6Value.createdAt instanceof Date; // true +prismaNextValue.createdAt instanceof Date; // true +prismaNextValue.createdAt.toISOString() === prisma6Value.createdAt.toISOString(); +``` + +This should hold for both `timestamp(3)` and `timestamptz` columns, with the +important distinction that `timestamp(3)` compatibility is a Prisma-level +mapping decision because PostgreSQL itself does not store a timezone. + +## Write Expectations + +When writing an explicit JavaScript `Date`, Prisma Next should store a value +that reads back the same way Prisma 6 would read it back: + +```ts +const input = new Date("2024-01-11T00:00:00.000Z"); + +const prisma6Row = await prisma.model.create({ data: { createdAt: input } }); +const prismaNextRow = await db.orm.Model.create({ createdAt: input }); + +prismaNextRow.createdAt instanceof Date; // true +prismaNextRow.createdAt.toISOString() === prisma6Row.createdAt.toISOString(); +``` + +The same rule applies to update data: + +```ts +await db.orm.NotificationEmail.where({ id }).update({ + deliveredAt: new Date("2024-01-15T04:00:00.000Z"), +}); +``` + +If Prisma 6 encodes the value as a timestamp string and Prisma Next passes a +JavaScript `Date` to the driver, that parameter-type difference is worth +recording. It should not change the stored value or the ORM result value. + +## Filter Expectations + +Date values in filters should use the same encoding rule as date values in +writes. A range query should match the same rows in Prisma 6 and Prisma Next: + +```ts +where: { + visitedAt: { + gte: new Date("2024-01-17T00:00:00.000Z"), + lt: new Date("2024-01-18T00:00:00.000Z"), + }, +} +``` + +This matters for `timestamp without time zone` columns. If encode and decode use +different timezone assumptions, equality and range filters can appear correct in +one local timezone and fail in another. + +## Defaults And `temporal.updatedAt()` + +`@default(now())` and `temporal.updatedAt()` should return `Date` instances +through normal ORM reads and mutation returns. + +For generated values: + +- The value should be close to the operation time. +- The value should use the target column's precision. +- For `timestamp(3)`, millisecond precision is the relevant precision. +- The returned `Date#toISOString()` value should match Prisma 6's observable + value for the same generated database value. + +For explicit `updatedAt` values, Prisma Next should preserve the caller's value +and should not replace it with the current time. + +## Precision + +Dub's `Timestamp3` maps to PostgreSQL `timestamp(3)`. Sub-millisecond precision +is out of scope for this contract. + +Prisma Next should either round or truncate in the same observable way Prisma 6 +does for PostgreSQL `timestamp(3)`. Tests should compare millisecond-precision +ISO strings, not higher precision PostgreSQL internals. + +## Parameter Metadata + +The runtime SQL comparison should capture parameter metadata separately from +result values. + +For each date parameter, record at least: + +- whether the runtime passed a JavaScript `Date`, a string, or another value + kind; +- the JavaScript constructor when applicable; +- the ISO value for `Date` parameters; +- the exact string for string parameters; +- the SQL placeholder position and target column when that is available. + +Prisma 6 and Prisma Next may use different intermediate parameter types. That is +not automatically a compatibility bug. It becomes a bug if the database state, +the selected result value, or the matched row set differs. + +## Observed Dub Issue + +In the local Europe/Rome runtime comparison, both sides usually returned +JavaScript `Date` instances. However, many `timestamp(3)` values differed by one +hour between Prisma 6 and Prisma Next. + +That is the important symptom to fix. It suggests that at least one side of the +Prisma Next encode/decode path is interpreting a `timestamp without time zone` +value with a different timezone rule than Prisma 6. + +Be careful when debugging this with raw database snapshots. The Dub comparison +also uses direct `pg` snapshots to prove fixture equality. Those snapshots are +useful, but the application compatibility target is still the Prisma ORM result: +same row, same typed field, same `Date#toISOString()` as Prisma 6. + +## Test Matrix + +Prisma Next should have focused PostgreSQL tests for these cases: + +1. Read a `timestamp(3)` row written by Prisma 6; the Prisma Next result is a + `Date` with the same ISO string. +2. Write an explicit `Date` to a `timestamp(3)` column through Prisma Next; read + it through Prisma 6 and Prisma Next; both ISO strings match. +3. Read and write the same values under `TZ=UTC` and `TZ=Europe/Rome`. +4. Repeat the read/write tests for winter and summer timestamps, such as + `2024-01-11T00:00:00.000Z` and `2024-07-11T00:00:00.000Z`. +5. Include daylight-saving boundary values, such as + `2024-03-31T00:30:00.000Z` and `2024-10-27T00:30:00.000Z`. +6. Use date equality and range filters against `timestamp(3)` columns and verify + that Prisma 6 and Prisma Next match the same rows. +7. Verify `@default(now())` values return `Date` instances and do not shift when + read back. +8. Verify `temporal.updatedAt()` values return `Date` instances, explicit + values are preserved, and generated values do not shift when read back. +9. Repeat the relevant tests for a `timestamptz` column to keep instant semantics + separate from `timestamp without time zone` compatibility. + +The expected result is boring but strict: Prisma Next can differ internally, but +the application should see the same date kinds and ISO values that Prisma 6 +would expose. diff --git a/docs/prisma-next-null-optional-relation-query-report.md b/docs/prisma-next-null-optional-relation-query-report.md new file mode 100644 index 00000000000..4b9da7bfafe --- /dev/null +++ b/docs/prisma-next-null-optional-relation-query-report.md @@ -0,0 +1,290 @@ +# Prisma Next emits unnecessary relation query for null optional FK + +## Title + +Prisma Next high-level ORM should skip optional relation include queries when all parent foreign keys are null + +## Summary + +When a Prisma Next high-level ORM query includes an optional relation whose parent foreign key is `null`, Prisma Next still emits a child relation query with `WHERE id IN ($1)` and `$1 = null`. + +Prisma 6 Client skips that child relation query. Both runtimes return the same result, but Prisma Next performs an unnecessary database round trip. + +This was observed in Dub's Prisma Next hybrid runtime SQL comparison harness for `dashboard.read.selected-relations`. + +## Base PSL schema + +The relevant shape is an optional one-to-one relation from `Dashboard` to `Folder` through a nullable unique foreign key: + +```prisma +types { + Timestamp3 = DateTime @db.Timestamp(3) +} + +model Dashboard { + id String @id @default(cuid(2)) + + link Link? @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade) + linkId String? @unique + + folder Folder? @relation(fields: [folderId], references: [id], onUpdate: Cascade, onDelete: Cascade) + folderId String? @unique + + project Project? @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade) + projectId String? + + doIndex Boolean @default(false) + password String? + showConversions Boolean @default(false) + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + @@index([projectId]) + @@map("Dashboard") +} + +model Folder { + id String @id @default(cuid(2)) + name String + projectId String + + @@map("Folder") +} + +model Link { + id String @id @default(cuid(2)) + domain String + key String + url String + projectId String? + + @@map("Link") +} + +model Project { + id String @id @default(cuid(2)) + slug String @unique + plan String @default("free") + + @@map("Project") +} +``` + +The seeded `Dashboard` row has a related `Link` and `Project`, but no related `Folder`: + +```txt +Dashboard.id = "dash_runtime_sql_existing" +Dashboard.linkId = "link_runtime_sql" +Dashboard.folderId = null +Dashboard.projectId = "proj_runtime_sql" +``` + +## TypeScript query API comparison + +| Prisma 6 Client | Prisma Next high-level ORM | +|---|---| +| `prisma.dashboard.findUnique(...)` | `db.orm.Dashboard.where(...).select(...).include(...).first()` | + +```ts +// Prisma 6 Client +await prisma.dashboard.findUnique({ + where: { id: dashboardIds.existing }, + select: { + id: true, + doIndex: true, + password: true, + showConversions: true, + link: { + select: { + id: true, + domain: true, + key: true, + url: true, + }, + }, + folder: { + select: { + id: true, + name: true, + }, + }, + project: { + select: { + plan: true, + }, + }, + }, +}); +``` + +```ts +// Prisma Next high-level ORM +await db.orm.Dashboard.where({ id: dashboardIds.existing }) + .select("id", "doIndex", "password", "showConversions") + .include("link", (link) => link.select("id", "domain", "key", "url")) + .include("folder", (folder) => folder.select("id", "name")) + .include("project", (project) => project.select("plan")) + .first(); +``` + +## Observed SQL + +Prisma 6 emits three queries. It fetches `Dashboard`, then fetches the non-null `Link` and `Project` relations. It does not query `Folder` because `Dashboard.folderId` is `null`. + +```sql +SELECT "public"."Dashboard"."id", + "public"."Dashboard"."doIndex", + "public"."Dashboard"."password", + "public"."Dashboard"."showConversions", + "public"."Dashboard"."linkId", + "public"."Dashboard"."folderId", + "public"."Dashboard"."projectId" +FROM "public"."Dashboard" +WHERE ("public"."Dashboard"."id" = $1 AND 1=1) +LIMIT $2 OFFSET $3; + +-- params: ["dash_runtime_sql_existing", 1, 0] +``` + +```sql +SELECT "public"."Link"."id", + "public"."Link"."domain", + "public"."Link"."key", + "public"."Link"."url" +FROM "public"."Link" +WHERE "public"."Link"."id" IN ($1) +OFFSET $2; + +-- params: ["link_runtime_sql", 0] +``` + +```sql +SELECT "public"."Project"."id", + "public"."Project"."plan" +FROM "public"."Project" +WHERE "public"."Project"."id" IN ($1) +OFFSET $2; + +-- params: ["proj_runtime_sql", 0] +``` + +Prisma Next emits four queries. The additional query fetches `Folder` with a null parameter: + +```sql +SELECT "Dashboard"."id" AS "id", + "Dashboard"."doIndex" AS "doIndex", + "Dashboard"."password" AS "password", + "Dashboard"."showConversions" AS "showConversions", + "Dashboard"."linkId" AS "linkId", + "Dashboard"."folderId" AS "folderId", + "Dashboard"."projectId" AS "projectId" +FROM "Dashboard" +WHERE "Dashboard"."id" = $1 +LIMIT 1; + +-- params: ["dash_runtime_sql_existing"] +``` + +```sql +SELECT "Link"."id" AS "id", + "Link"."domain" AS "domain", + "Link"."key" AS "key", + "Link"."url" AS "url" +FROM "Link" +WHERE "Link"."id" IN ($1); + +-- params: ["link_runtime_sql"] +``` + +```sql +SELECT "Folder"."id" AS "id", + "Folder"."name" AS "name" +FROM "Folder" +WHERE "Folder"."id" IN ($1); + +-- params: [null] +``` + +```sql +SELECT "Project"."plan" AS "plan", + "Project"."id" AS "id" +FROM "Project" +WHERE "Project"."id" IN ($1); + +-- params: ["proj_runtime_sql"] +``` + +## Observed result + +Both runtimes return the same JavaScript result value and type shape for this read: + +```txt +fixtureBeforeEqual true +fixtureAfterEqual true +resultTypeShapeEqual true +resultValueSummaryEqual true + +Prisma 6 query count 3 +Prisma Next query count 4 +``` + +The extra Prisma Next query does not change the result. It only adds work: + +```ts +{ + id: "dash_runtime_sql_existing", + doIndex: false, + password: "old-password", + showConversions: false, + link: { /* selected Link fields */ }, + folder: null, + project: { /* selected Project fields */ }, +} +``` + +## Expected behavior + +Before issuing a batched child relation query, Prisma Next should filter out null foreign-key values collected from parent rows. + +If the filtered key set is empty, Prisma Next should skip the child relation query and resolve the included optional relation to `null` for those parent rows. + +For this case, Prisma Next should emit three queries, not four. + +## Impact + +This is not a correctness bug for the observed query. It is an efficiency issue. + +The extra query adds one database round trip for every included optional relation where all parent foreign keys are null. In hot paths, this can increase latency, database load, and query trace noise. + +The issue can compound when a query includes several optional relations or when many parent rows have null relation keys. + +## Reproduction command in Dub + +```sh +PATH="$HOME/.nvm/versions/node/v24.13.0/bin:$PATH" \ +DATABASE_URL="postgresql://postgres:postgres@localhost:5432/dub" \ +pnpm --filter=@dub/prisma next:sql:compare +``` + +The generated JSON report is written to: + +```txt +packages/prisma/.tmp/prisma-next-runtime-sql-comparison.json +``` + +The relevant operation is: + +```txt +dashboard.read.selected-relations +``` + +## Environment + +```txt +Prisma 6 runtime: @prisma/client with @prisma/adapter-pg +Prisma Next runtime: @prisma-next/postgres/runtime from local prisma-next-clean tarballs +Database: PostgreSQL 16 +Node: 24 +Dub branch: port/prisma-next-hybrid +``` diff --git a/docs/prisma-next-runtime-sql-comparison.md b/docs/prisma-next-runtime-sql-comparison.md new file mode 100644 index 00000000000..fb9c48417bf --- /dev/null +++ b/docs/prisma-next-runtime-sql-comparison.md @@ -0,0 +1,220 @@ +# Prisma Next Runtime SQL Comparison + +This branch compares Prisma 6 Client and Prisma Next one runtime module at a +time, without changing app-wide Prisma imports. + +Current modules: + +- `dashboard-runtime-module`: Dashboard relation reads plus create, update, and + delete writes. +- `user-runtime-module`: user existence lookups by `User.id`. +- `link-runtime-module`: short-link existence lookups by the `Link.domain/key` + compound identity. +- `edge-link-runtime-module`: edge link reads by `shortLink` and by + `domain/key` with webhook ids. +- `analytics-runtime-module`: all-time link analytics aggregates for the raw + shortcut in `getAnalytics`. +- `commissions-payouts-runtime-module`: commissions and payouts reads, + aggregates, grouped aggregates, relation filters, includes, and update-count + writes. +- `notification-email-runtime-module`: notification email webhook reads/writes + plus campaign summary aggregation. +- `postback-runtime-module`: partner postback lookup, JSON trigger filtering, + and disable writes. +- `usage-counter-runtime-module`: link, workspace, and program-enrollment + usage counter reads and writes. +- `workspace-product-runtime-module`: workspace product resolution from + `Project.defaultProgramId`. +- `workspace-runtime-module`: workspace fetchers with membership metadata. +- `edge-workspace-runtime-module`: edge workspace reads by id, with and + without domain slugs. +- `folder-runtime-module`: folder access lookups with filtered `FolderUser` + includes. +- `integration-runtime-module`: verified integrations installed in a workspace. +- `tag-runtime-module`: tag list/search reads plus create, update, and delete + writes. +- `token-runtime-module`: restricted token listing with user includes plus + update and delete writes. +- `webhook-runtime-module`: workspace webhook reads with `LinkWebhook` includes + plus update and delete writes. +- `installed-integration-runtime-module`: installed integration lookup and + delete writes. +- `domain-runtime-module`: workspace domain scalar reads. +- `program-runtime-module`: basic program fetcher reads. +- `program-network-runtime-module`: marketplace program availability counting + and aggregations through `Program`, `ProgramCategory`, and `PartnerGroup` + relation filters. +- `partner-group-runtime-module`: partner group list reads with expanded + enrollment counters. +- `program-application-runtime-module`: program application reads/review + writes plus application event funnel counts and relation includes. +- `bounty-runtime-module`: bounty details, grouped submission counts, and + review writes. +- `partner-runtime-module`: partner profile reads and update writes. +- `program-enrollment-runtime-module`: program enrollment compound-key reads + and partner includes. +- `customer-runtime-module`: customer cursor and list reads. + +Latest run, using Prisma Next tarballs packed from `origin/main` at +`7044a2295bc398cec86e5c9cada3e932fcac486d` on 2026-05-13: + +- 27 modules, 72 operations: 49 reads and 23 writes. +- Operation failures: 0. +- Prisma 6 emitted 117 captured queries; Prisma Next emitted 107. +- Same query count: 48/72 operations. +- Prisma Next emitted fewer queries for 16 operations and more queries for 8 + operations. +- Result type shape equal: 69/72 operations. +- Result value summary equal: 35/72 operations. +- Before fixture equal: 72/72 operations. +- After fixture equal: 53/72 operations overall, and 4/23 write operations. +- Query parameter kinds differed sharply: Prisma 6 sent no captured `Date` + parameters and represented timestamp writes as strings, while Prisma Next + sent 32 captured `Date` parameters. +- The companion DDL compare found 296 expected differences and 0 unexpected + differences. The new category is 44 `updatedAt` column-type differences: + `temporal.updatedAt()` currently emits `timestamptz`, while Dub's Prisma 6 + PostgreSQL schema uses `timestamp(3)`. + +Known visible result-type differences: + +- `analytics.read.all-time-composite-for-link`: Prisma 6 returns + `Link.saleAmount` aggregate sums as `bigint`; Prisma Next currently returns + the same safe value as `number`. +- `folder.read.by-id-with-user`: the top-level `Folder` timestamp fields still + come back as `Date`, but the included `FolderUser.createdAt` and + `FolderUser.updatedAt` values currently come back from Prisma Next as + strings. +- `program-enrollment.read.by-partner-program`: Prisma 6 returns + `ProgramEnrollment.totalCommissions` as `bigint`; Prisma Next currently + returns the selected `bigint` column as `string`. + +Tracked write-query differences: + +- `temporal.updatedAt()` now appears in Prisma Next create and non-empty + update SQL for the covered high-level ORM writes. Prisma 6 still sends + generated timestamp values as timestamp strings, while Prisma Next sends + JavaScript `Date` parameters to the driver. +- Counter increments are not equivalent through the current Prisma Next + high-level ORM. Prisma 6 emits atomic `SET field = field + $n` updates. The + Prisma Next high-level fallback currently reads the current value first, + checks the target row, then writes the computed scalar value plus + `updatedAt`. +- Multi-row count writes have different orchestration. For example, + `commissions.update.mark-paid-count` captures Prisma 6 as + `BEGIN` + matching-row `SELECT` + `UPDATE ... updatedAt = $n` + `COMMIT`, + while Prisma Next `updateCount` captures a matching-row `SELECT` followed by + `UPDATE ... updatedAt = $n` without an explicit transaction. +- Scalar update writes such as `payouts.update.pending-amount` keep matching + result shapes. Their `updatedAt` values now differ only by execution-time + milliseconds in ORM results, but raw fixture snapshots still expose the + timestamp encoding difference described below. +- `notification-email.aggregate.campaign-summary` maps one Prisma 6 raw SQL + query with `SUM(CASE WHEN ...)` into four Prisma Next high-level count + aggregates because that CASE aggregate shape is not represented by the + current high-level ORM API. +- Explicit date writes such as `notification-email.update.delivered-at`, + `postback.update.disable`, `usage.update.link-click-increment`, + `program-application.update.reject`, and + `bounty-submission.update.approve` expose a parameter-encoding difference: + Prisma 6 sends the `Date` update value as a timestamp string, while Prisma + Next sends a JavaScript `Date` to the driver. The returned JS value shape + usually matches, but raw fixture snapshots capture the resulting + `timestamp(3)` state difference. +- Date values still need follow-up. In the Europe/Rome run from + 2026-05-13, many existing `timestamp(3)` reads differed by one hour in ORM + results, and raw fixture snapshots for generated May 2026 timestamps differed + by two hours because the process was in CEST. See + `docs/prisma-next-date-value-expectations.md` for the expected Prisma 6 + compatibility behavior. +- `postback.read.enabled-for-trigger` keeps the Prisma 6 JSON + `array_contains` predicate as the baseline. The current Prisma Next + high-level ORM path fetches enabled partner postbacks and applies the JSON + trigger membership check in JavaScript. +- `program-application-event.aggregate.funnel-summary` maps one Prisma 6 raw + SQL query with multiple `COUNT(column)` metrics into five Prisma Next + high-level count aggregates, one for each funnel step. +- `program-network.aggregate.marketplace-reward-types` maps one Prisma 6 raw + SQL query with four `COUNT(column)` metrics into four Prisma Next high-level + filtered count aggregates. +- `bounty.read.details-with-groups` maps a Prisma 6 raw SQL query with a + lateral-style JSON aggregate into Prisma Next high-level relation includes + over `Workflow` and `BountyGroup`. +- `partner-group.read.expanded-list` maps a Prisma 6 raw SQL aggregate join + into a Prisma Next high-level `PartnerGroup` read with included + `ProgramEnrollment` rows and JavaScript-side counter folding. + +Harness compatibility notes for the 2026-05-13 run: + +- Prisma Next now treats the built-in `pg/json@1` and `pg/jsonb@1` codecs as + non-parameterized. The generated Dub contract normalization removes + `typeParams` and JSON `typeRef` usage from JSON columns so runtime codec + integrity validation can pass. +- The runtime marker table now uses `space text` as its primary key. The + comparison and smoke harnesses create `prisma_contract.marker` with the + current shape so marker verification reaches the runtime operation under + test. + +## Runtime Capture + +`pnpm --filter=@dub/prisma next:sql:compare` runs equivalent module operations +against two isolated scratch PostgreSQL databases with the same minimal schema +and seed data. + +The comparison is collected inside the two runtimes, not inferred from server +logs. That keeps it tied to the exact SQL, encoded parameters, and JavaScript +result values observed by the application boundary under test. + +- Prisma 6 capture happens at the `pg` pool/client query boundary used by + `@prisma/adapter-pg`. The collector wraps pool-level calls and acquired + clients, so transactional update/delete paths are captured along with normal + reads. This records the SQL and the parameter values after Prisma 6 has + mapped them for the driver. Prisma Client query events are also stored as + sidecar metadata. +- Prisma Next capture happens in runtime middleware before driver execution. + This records the lowered SQL plan, encoded parameters, and plan metadata + emitted by the high-level `db.orm` API. +- Results are summarized by JavaScript value shape, including constructors such + as `Date`, so type differences are visible separately from dynamic values. + Known mismatches stay visible in the report instead of being normalized away. +- Every operation records before/after database snapshots for both runtimes. + The before snapshot proves the fixture is identical before running a read or + write; the after snapshot shows how each runtime changed its own database. + +By default both scratch databases are created on the Postgres server pointed at +by `DATABASE_URL`. To run the comparison against two separate Postgres +instances, pass different roots: + +```sh +PRISMA6_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/dub \ +PRISMA_NEXT_DATABASE_URL=postgresql://postgres:postgres@localhost:5433/dub \ +pnpm --filter=@dub/prisma next:sql:compare +``` + +The JSON report is written to +`packages/prisma/.tmp/prisma-next-runtime-sql-comparison.json`. + +## Raw SQL Inventory + +`pnpm --filter=@dub/prisma next:raw:inventory` statically scans raw SQL +execution sites in `apps/` and `packages/`. + +The classifier is intentionally conservative: + +- `orm-api`: likely single-model CRUD/read shape. +- `query-builder-api`: likely needs the lower-level Prisma Next SQL builder or + a focused ORM aggregate/grouping port. +- `not-currently-covered`: uses constructs such as CTEs, JSON operators, + window functions, dynamic lists, or custom SQL expressions. +- `manual-review`: dynamic/unsafe SQL or a call site where the scanner cannot + see the full query. + +The JSON report is written to +`packages/prisma/.tmp/prisma-next-raw-sql-inventory.json`. + +Latest inventory: + +- Raw SQL execution sites: 41. +- Prisma SQL fragments: 146. +- Classification: 12 `orm-api`, 11 `query-builder-api`, 14 + `not-currently-covered`, and 4 `manual-review`. diff --git a/docs/prisma-next-updatedat-expectations.md b/docs/prisma-next-updatedat-expectations.md new file mode 100644 index 00000000000..2e87d7e6f7b --- /dev/null +++ b/docs/prisma-next-updatedat-expectations.md @@ -0,0 +1,404 @@ +# Prisma Next `temporal.updatedAt()` Expectations + +This document describes the `temporal.updatedAt()` behavior I would expect +Prisma Next to match when porting Dub from Prisma 6 Client semantics. + +The short version: Prisma 6 `@updatedAt` and Prisma Next +`temporal.updatedAt()` should mean the same runtime thing. It is an +application-side mutation default, not a database default, trigger, generated +column, or migration-time DDL feature. For ORM writes, Prisma should populate +it when the user omits it on create and on non-empty update mutations. If the +user supplies an explicit value, that value must win. + +## Baseline Schema + +In Dub's Prisma 6 schema this pattern appears repeatedly: + +```prisma +model Dashboard { + id String @id @default(cuid()) + + password String? + doIndex Boolean @default(false) + showConversions Boolean @default(false) + + createdAt DateTime @default(now()) @db.Timestamp(3) + updatedAt DateTime @updatedAt @db.Timestamp(3) +} +``` + +The Prisma Next contract equivalent is: + +```prisma +types { + Timestamp3 = DateTime @db.Timestamp(3) +} + +model Dashboard { + id String @id @default(cuid(2)) + + password String? + doIndex Boolean @default(false) + showConversions Boolean @default(false) + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() +} +``` + +## Contract And DDL Expectations + +`temporal.updatedAt()` should lower to execution metadata without losing the +storage semantics of the Prisma 6 field it replaces. For Dub, that means the +column remains PostgreSQL `timestamp(3)`. + +Expected contract meaning: + +- `onCreate`: if the field is omitted, generate the current application + timestamp. +- `onUpdate`: if the field is omitted and the update payload is non-empty, + generate the current application timestamp. +- Explicit user values override both defaults. + +Expected PostgreSQL DDL meaning: + +- No `DEFAULT now()` should be added for `updatedAt` just because the field has + `@updatedAt`. +- No trigger should be generated. +- No `ON UPDATE` clause should be simulated in DDL. +- If the PSL field is required, the column should still be `NOT NULL`; Prisma's + runtime must provide a value on create. + +`createdAt @default(now())` and `updatedAt @updatedAt` are different concepts. +`createdAt` may be represented as a storage default. `updatedAt` is an ORM +mutation default. + +## Create Semantics + +When the user omits `updatedAt` in a create, Prisma should insert one. + +Prisma 6 API: + +```ts +await prisma.dashboard.create({ + data: { + id: "dash_1", + password: "secret", + }, +}); +``` + +Expected Prisma Next high-level API: + +```ts +await db.orm.Dashboard.create({ + id: "dash_1", + password: "secret", +}); +``` + +Expected semantic SQL shape: + +```sql +INSERT INTO "Dashboard" ("id", "password", "updatedAt") +VALUES ($1, $2, $3) +RETURNING ... +``` + +`$3` should be the current application timestamp. + +If `createdAt @default(now())` is also omitted, Prisma Next may let the database +fill `createdAt`, but `updatedAt` must still be present unless the target has a +separate, explicitly supported way to satisfy the same app-level mutation +default. + +The returned JavaScript value for `updatedAt` should be a `Date` for normal ORM +queries, matching Prisma 6's user-facing result shape. + +## Explicit Create Value + +When the user supplies `updatedAt`, Prisma must not overwrite it. + +Prisma 6 API: + +```ts +const explicitUpdatedAt = new Date("2001-02-03T04:05:06.000Z"); + +await prisma.dashboard.create({ + data: { + id: "dash_1", + password: "secret", + updatedAt: explicitUpdatedAt, + }, +}); +``` + +Expected Prisma Next high-level API: + +```ts +const explicitUpdatedAt = new Date("2001-02-03T04:05:06.000Z"); + +await db.orm.Dashboard.create({ + id: "dash_1", + password: "secret", + updatedAt: explicitUpdatedAt, +}); +``` + +Expected behavior: + +- The inserted `updatedAt` value is `explicitUpdatedAt`. +- No generated timestamp replaces it. +- The returned value represents the same instant. + +## Update Semantics + +When the user performs a non-empty update and omits `updatedAt`, Prisma should +set `updatedAt` to the current application timestamp. + +Prisma 6 API: + +```ts +await prisma.dashboard.update({ + where: { id: "dash_1" }, + data: { + password: "new-secret", + }, +}); +``` + +Expected Prisma Next high-level API: + +```ts +await db.orm.Dashboard.where({ id: "dash_1" }).update({ + password: "new-secret", +}); +``` + +Expected semantic SQL shape: + +```sql +UPDATE "Dashboard" +SET "password" = $1, "updatedAt" = $2 +WHERE "Dashboard"."id" = $3 +RETURNING ... +``` + +`$2` should be the current application timestamp. + +This should apply to all non-empty ORM update paths that mutate rows of a model +with an `@updatedAt` field: + +- `update` +- `updateMany` +- `updateManyAndReturn`, where supported +- the update branch of `upsert` +- nested updates, for each nested model row that is actually updated + +Prisma should not compare old and new values. Setting a field to its existing +value is still a non-empty update payload and should advance `updatedAt` if the +runtime emits an update. + +## Explicit Update Value + +When the user supplies `updatedAt` in an update payload, Prisma must use that +value and must not replace it with the current timestamp. + +Prisma 6 API: + +```ts +const explicitUpdatedAt = new Date("2001-02-03T04:05:06.000Z"); + +await prisma.dashboard.update({ + where: { id: "dash_1" }, + data: { + password: "new-secret", + updatedAt: explicitUpdatedAt, + }, +}); +``` + +Expected Prisma Next high-level API: + +```ts +const explicitUpdatedAt = new Date("2001-02-03T04:05:06.000Z"); + +await db.orm.Dashboard.where({ id: "dash_1" }).update({ + password: "new-secret", + updatedAt: explicitUpdatedAt, +}); +``` + +Expected semantic SQL shape: + +```sql +UPDATE "Dashboard" +SET "password" = $1, "updatedAt" = $2 +WHERE "Dashboard"."id" = $3 +RETURNING ... +``` + +`$2` should be `explicitUpdatedAt`, not a generated timestamp. + +## Empty Update Semantics + +An empty update payload should not advance `updatedAt`. + +Prisma 6 API: + +```ts +await prisma.dashboard.update({ + where: { id: "dash_1" }, + data: {}, +}); +``` + +Expected behavior: + +- `updatedAt` remains unchanged. +- Prisma Next should not apply the `onUpdate` mutation default. +- Ideally Prisma Next should avoid emitting an unnecessary SQL update. If it + does emit one for API compatibility, it must not change `updatedAt`. + +"Empty" means empty after input normalization. Fields omitted by JavaScript +`undefined` or an equivalent skip marker should not make the update non-empty. +Explicit `null`, scalar operations such as `increment`, and relation operations +that actually mutate rows are non-empty. + +## Upsert Semantics + +For `upsert`, each branch should behave like the corresponding standalone +operation. + +Create branch: + +- If `updatedAt` is omitted from `create`, generate it. +- If `updatedAt` is supplied in `create`, preserve the explicit value. + +Update branch: + +- If `update` is non-empty and omits `updatedAt`, generate it. +- If `update` supplies `updatedAt`, preserve the explicit value. +- If `update` is empty, leave `updatedAt` unchanged. + +## Bulk Write Semantics + +For `createMany`, each inserted row should receive an `updatedAt` value when the +row omits it. + +For `updateMany`, every row matched and updated by a non-empty payload should +receive the same generated `updatedAt` value for that operation unless Prisma +Next has a clear target-level reason to do otherwise. + +The generated value should be stable within a single lowered mutation. Avoid +calling `new Date()` separately per row when one ORM operation maps to one bulk +mutation. + +## Raw SQL And Lower-Level APIs + +`@updatedAt` is a Prisma ORM behavior. It should not silently affect raw SQL. + +These calls should not receive automatic `updatedAt` handling unless the caller +explicitly opts into an ORM mutation-default layer: + +- Prisma 6 `$executeRaw` +- Prisma 6 `$queryRaw` +- Prisma Next low-level SQL builders that directly express SQL +- Direct `pg` calls +- External database writes + +If a low-level Prisma Next query builder is intended to be a typed SQL builder +rather than an ORM mutation API, it should not add `updatedAt` implicitly. + +## Timestamp Source And Encoding + +The generated timestamp is an application timestamp. In practice, this means the +runtime should build a JavaScript `Date` or an equivalent target timestamp value +at execution time, then encode it through the target adapter. + +For PostgreSQL `timestamp(3)` columns, the observable user-facing behavior should +match Prisma 6: + +- ORM query results should expose `Date` instances. +- The returned `Date` should represent the stored value consistently. +- Explicit `Date` inputs should round-trip without being shifted by the database + session time zone. +- Automatically generated values should use the same precision as the target + column can store; for Dub's `Timestamp3`, millisecond precision is enough. + +Avoid mixing a UTC app timestamp with a database-local `timestamp without time +zone` encoding in a way that makes Prisma Next return a value that differs from +the value Prisma 6 would return for the same ORM call. + +## Failure And No-Row Cases + +If an update throws because no row exists, no `updatedAt` value is observable. + +If `updateMany` matches zero rows, the returned count should be zero and no row +state should change. + +If an update fails after the timestamp is generated but before commit, the +timestamp should not leak into database state. + +## Validation Expectations + +For this Dub port, the important supported shape is a required timestamp field +with an update-time execution default: + +```prisma +updatedAt temporal.updatedAt() +``` + +Invalid or out-of-scope forms should fail during authoring or contract +validation rather than at execution time: + +- non-timestamp fields, such as `String @updatedAt` in Prisma 6 syntax +- list fields +- relation fields +- `@updatedAt` with arguments in Prisma 6 syntax +- ambiguous Prisma 6 combinations that also define a field default, such as + `DateTime @updatedAt @default(now())` + +Optional update-time fields are not needed for Dub. If Prisma Next chooses to +support them later, they should still follow the same mutation-default +semantics: omitted create/update values get a timestamp, explicit `null` must +be specified and tested deliberately. + +## Compatibility Tests To Add + +At minimum, Prisma Next should have tests for these cases against PostgreSQL: + +1. `create` omits `updatedAt`: returned row has `updatedAt instanceof Date`. +2. `create` supplies `updatedAt`: returned row equals the explicit value. +3. `update` with non-empty data omits `updatedAt`: returned row has a newer + `updatedAt`. +4. `update` supplies `updatedAt`: returned row equals the explicit value. +5. `update` with empty data leaves `updatedAt` unchanged. +6. `updateMany` with non-empty data updates `updatedAt` on all matched rows. +7. `updateMany` with zero matched rows changes no state. +8. `upsert` create branch omits `updatedAt`: generated value is present. +9. `upsert` update branch omits `updatedAt`: generated value is present when + `update` is non-empty. +10. `upsert` update branch with `update: {}` leaves `updatedAt` unchanged. +11. A raw SQL update does not receive implicit `updatedAt` handling. +12. PSL and TS authoring produce byte-equivalent contract execution defaults. + +For Dub specifically, the high-level ORM update: + +```ts +await db.orm.Tag.where({ id }).update({ name: "Updated" }); +``` + +should lower semantically like this: + +```sql +UPDATE "Tag" +SET "name" = $1, "updatedAt" = $2 +WHERE "Tag"."id" = $3 +RETURNING ... +``` + +The latest Dub comparison showed Prisma 6 doing this for analogous updates, +while Prisma Next high-level ORM updates were still returning the old +`updatedAt` for several modules. That is the compatibility gap this expectation +file is meant to make explicit. diff --git a/docs/prisma-next-write-atomic-expectations.md b/docs/prisma-next-write-atomic-expectations.md new file mode 100644 index 00000000000..2865994ff38 --- /dev/null +++ b/docs/prisma-next-write-atomic-expectations.md @@ -0,0 +1,495 @@ +# Prisma Next Atomic Operation Expectations + +This document describes the expected Prisma Next work for atomic numeric writes +on PostgreSQL. + +The important correction is that Prisma Next's SQL high-level ORM does not +currently support atomic numeric operations. The goal is not to bless Dub's +temporary read-then-write fallback. The goal is to implement the ADR 180 +field-operation API shape for SQL/Postgres, then lower those operations to real +database-side arithmetic. + +In other words, Prisma 6 expresses the operation like this: + +```ts +await prisma.link.update({ + where: { id }, + data: { + clicks: { increment: 1 }, + }, +}); +``` + +Prisma Next should be able to express the same intent through an ADR 180-style +field accessor: + +```ts +await db.orm.Link.where({ id }).update((link) => [ + link.clicks.inc(1), +]); +``` + +or an equivalent field-operation API. The exact method names can be refined, +but the operation must be represented as an atomic field operation in the query +plan, not as JavaScript code that reads the old value and writes a replacement. + +## Current State + +The current Prisma Next SQL update API accepts scalar replacement objects. It +does not expose a high-level way to say "set this column to its current value +plus this amount." + +That is why the Dub runtime comparison currently uses this fallback for some +ported modules: + +1. Read the current counter value with Prisma Next. +2. Add the increment amount in JavaScript. +3. Write the computed scalar value back with `.update({ clicks: nextValue })`. + +That fallback can make a single-threaded fixture pass, but it is not equivalent +to Prisma 6. + +The gap should be tracked as a missing Prisma Next API and lowering feature, +not as an acceptable runtime difference. + +## ADR 180 Target + +ADR 180 defines a callable/dot-path field accessor used by both reads and +writes. Its mutation examples include targeted field operations: + +```ts +db.users.where({ id }).update((u) => [ + u("homeAddress.city").set("LA"), + u("stats.loginCount").inc(1), + u("tags").push("premium"), +]); +``` + +The Mongo implementation already appears to follow this direction in the local +Prisma Next checkout: + +- `packages/2-mongo-family/5-query-builders/query-builder/src/update-ops.ts` + defines typed update operations including `$inc` and `$mul`. +- `packages/2-mongo-family/5-query-builders/query-builder/src/field-accessor.ts` + exposes `inc()` and `mul()` on field expressions. +- `packages/2-mongo-family/5-query-builders/query-builder/test/writes.test.ts` + asserts that `f.amount.inc(1)` folds into `{ $inc: { amount: 1 } }`. +- `packages/2-mongo-family/5-query-builders/orm/test/collection.test.ts` + covers ORM callback writes such as `u.loginCount.inc(1)`. + +That is not proof that every Mongo edge case is complete. It is enough to show +the intended architecture: a write callback produces typed field operations, +and the target lowers those operations to native atomic updates. + +For SQL/Postgres, the same architecture should apply to top-level numeric +columns. ADR 180 currently says SQL is limited to set/unset for JSONB paths. +That limitation should not block scalar column arithmetic. A normal Postgres +column can represent `SET "clicks" = "clicks" + $1` directly. + +## Scope + +This document covers PostgreSQL writes for numeric scalar fields that Prisma 6 +currently supports through atomic number operations: + +- `increment` +- `decrement` +- `multiply` +- `divide` + +It applies to: + +- `update`; +- `updateMany` / Prisma Next `updateCount`; +- unique and compound-unique `where` filters; +- ordinary scalar assignments in the same mutation; +- implicit and explicit `@updatedAt`; +- returned rows and affected-row counts. + +It does not try to settle every connector-specific edge case. Nullable numeric +fields, `Decimal` precision, integer division details, JSONB path arithmetic, +and nested writes need their own tests once the core SQL field-operation +surface exists. + +## Prisma 6 Observable Behavior + +In Prisma 6, this update: + +```ts +await prisma.link.update({ + where: { id }, + data: { + clicks: { increment: 1 }, + lastClicked: new Date("2024-02-01T00:00:00.000Z"), + }, + select: { + id: true, + clicks: true, + lastClicked: true, + updatedAt: true, + }, +}); +``` + +lowers semantically like this: + +```sql +UPDATE "Link" +SET + "clicks" = "Link"."clicks" + $1, + "lastClicked" = $2, + "updatedAt" = $3 +WHERE "Link"."id" = $4 +RETURNING "Link"."id", "Link"."clicks", "Link"."lastClicked", "Link"."updatedAt"; +``` + +Prisma 6 may issue a preliminary identity lookup for some operation shapes. +That lookup does not compute the new counter value. The numeric +read-modify-write happens inside the database `UPDATE` statement. + +## Required API Shape + +The preferred Prisma Next API is an ADR 180-style update callback: + +```ts +await db.orm.Link.where({ id }) + .select("id", "clicks", "lastClicked", "updatedAt") + .update((link) => [ + link.clicks.inc(1), + link.lastClicked.set(new Date("2024-02-01T00:00:00.000Z")), + ]); +``` + +For compound filters: + +```ts +await db.orm.ProgramEnrollment.where({ + partnerId_programId: { + partnerId, + programId, + }, +}) + .select("id", "totalClicks", "updatedAt") + .update((enrollment) => [ + enrollment.totalClicks.inc(1), + ]); +``` + +For multi-row count writes: + +```ts +const count = await db.orm.Link.where((link) => + link.projectId.eq(projectId), +).updateCount((link) => [ + link.clicks.inc(1), +]); +``` + +The SQL API does not need to copy Prisma 6's object spelling. It may also +support a compatibility object form later: + +```ts +await db.orm.Link.where({ id }).update({ + clicks: { increment: 1 }, +}); +``` + +But the field-operation callback is the better fit for Prisma Next because it +matches ADR 180 and the Mongo implementation shape. + +## Operation Mapping + +The SQL field-operation surface should cover the Prisma 6 operation set. + +| Prisma 6 operation | ADR 180-style operation | Required PostgreSQL lowering | +| --- | --- | --- | +| `{ increment: n }` | `field.inc(n)` | `"field" = "field" + $n` | +| `{ decrement: n }` | `field.inc(-n)` or `field.dec(n)` | `"field" = "field" - $n` | +| `{ multiply: n }` | `field.mul(n)` | `"field" = "field" * $n` | +| `{ divide: n }` | `field.div(n)` or equivalent | `"field" = "field" / $n` | + +`inc()` and `mul()` already match the Mongo/ADR naming. `dec()` and `div()` can +be aliases or separate SQL-capability-gated operations. The important point is +that Prisma Next must represent all four Prisma 6 atomic number operations +without making the application pre-read the current field value. + +## Required Lowering + +The database must compute the new numeric value from the row version it +updates. + +For a single increment: + +```sql +UPDATE "Link" +SET "clicks" = "Link"."clicks" + $1 +WHERE "Link"."id" = $2 +RETURNING "Link"."id", "Link"."clicks"; +``` + +For multiple fields: + +```sql +UPDATE "Project" +SET + "usage" = "Project"."usage" + $1, + "totalClicks" = "Project"."totalClicks" + $2, + "updatedAt" = $3 +WHERE "Project"."id" = $4 +RETURNING "Project"."id", "Project"."usage", "Project"."totalClicks", "Project"."updatedAt"; +``` + +For division: + +```sql +UPDATE "SomeModel" +SET "score" = "SomeModel"."score" / $1 +WHERE "SomeModel"."id" = $2 +RETURNING "SomeModel"."score"; +``` + +If the current relational AST only allows update assignments to be parameters +or column references, it must grow an assignment-expression node. Atomic SQL +updates need an AST representation for binary arithmetic over a target column +and an encoded parameter. + +## Required Atomicity + +Prisma Next must not lower an atomic operation by selecting the current value +into JavaScript and then writing an absolute replacement value: + +```sql +SELECT "Link"."clicks" FROM "Link" WHERE "Link"."id" = $1 LIMIT 1; +UPDATE "Link" SET "clicks" = $1 WHERE "Link"."id" = $2; +``` + +That shape is not equivalent to Prisma 6. It can lose updates under +concurrency: + +1. Row starts with `clicks = 5`. +2. Request A reads `5`. +3. Request B reads `5`. +4. Request A writes `6`. +5. Request B writes `6`. + +The Prisma 6-compatible result is `7`, not `6`. + +PostgreSQL already gives the right behavior for a single arithmetic `UPDATE`. +Concurrent updates to the same row serialize through row locking, and each +statement applies its arithmetic to the current committed row version. + +An explicit transaction is not a substitute for database-side arithmetic. A +transaction can preserve commit and rollback shape for multi-statement writes, +but it does not make an application-side read-compute-write equivalent to +`SET field = field + $n` under PostgreSQL's default `READ COMMITTED` +isolation. + +See `docs/prisma-next-write-transactions.md` for the separate transaction +expectations. + +## Type Expectations + +Atomic numeric operators should be trait-gated. + +They should be available on numeric fields and unavailable on strings, dates, +booleans, JSON, relations, and value-object subtrees that do not resolve to a +numeric leaf. + +The operand type should preserve the field's write type: + +- `Int` operands should accept Prisma-compatible integer inputs. +- `BigInt` operands should not be coerced through JavaScript `number`. +- `Decimal` operands should preserve decimal precision if and when Decimal + atomic operations are supported. + +Prisma Next should encode the operand as a query parameter using the same codec +path it uses for ordinary writes to that field. The operand should appear in +the SQL parameter list. The current database value should not appear in the +JavaScript parameter list because JavaScript should not read it. + +## `@updatedAt` + +When an atomic update touches a model with an `@updatedAt` field and the caller +does not supply that field explicitly, Prisma Next should include `updatedAt` +in the same `UPDATE` statement as the arithmetic expression. + +Expected shape: + +```sql +UPDATE "Link" +SET + "clicks" = "Link"."clicks" + $1, + "updatedAt" = $2 +WHERE "Link"."id" = $3 +RETURNING ...; +``` + +If the caller supplies `updatedAt` explicitly, Prisma Next should use that +explicit value in the same `UPDATE` statement. + +If the update payload is empty, Prisma Next should not manufacture an atomic +write or advance `updatedAt`. + +## `updateMany` And Count Writes + +For `updateMany`, Prisma 6 returns a count and updates all matching rows. When +the payload contains atomic operations, Prisma Next should use database-side +expressions for every matching row: + +```sql +UPDATE "Link" +SET + "clicks" = "Link"."clicks" + $1, + "updatedAt" = $2 +WHERE ... +``` + +If Prisma Next can implement the operation as one `UPDATE`, that is the +preferred shape. + +If Prisma Next needs a preliminary `SELECT` to preserve Prisma-compatible +count, error, or authorization behavior, the dependent statements should run +inside one explicit transaction. The arithmetic still belongs in the database +`UPDATE`; the preliminary `SELECT` must not compute the new numeric values. + +## Return Values + +For `update`, Prisma Next should return the post-update row. Returned numeric +fields should reflect the value produced by the database-side arithmetic. + +For `updateCount`, Prisma Next should return the number of rows affected by the +Prisma mutation. If zero rows match, the count should be zero and no row should +change. + +If no row exists for `update`, Prisma Next should preserve Prisma-compatible +not-found behavior. A preliminary identity lookup may help implement that +behavior, but it must not compute atomic scalar values. + +## Acceptable Internal Differences + +Prisma Next does not need byte-for-byte identical SQL. These differences are +acceptable if observable behavior matches Prisma 6: + +- schema-qualified names versus unqualified table names; +- different placeholder numbers; +- equivalent casts for numeric, enum, or timestamp values; +- a preliminary identity lookup for Prisma-compatible not-found behavior; +- `UPDATE ... RETURNING` instead of a later post-update read; +- a stricter transaction wrapper when the implementation truly needs multiple + dependent statements. + +These differences are not acceptable: + +- no high-level API for atomic numeric field operations; +- reading the current numeric field value into JavaScript and writing an + absolute replacement value; +- exposing only raw SQL as the solution for normal ORM counter updates; +- splitting one dependent Prisma mutation across multiple autocommit + statements; +- updating counters without applying required `@updatedAt` behavior; +- returning a value computed in JavaScript instead of the database's + post-update value; +- silently degrading concurrent increments into last-write-wins assignments. + +## Dub Runtime Gap + +The latest Dub comparison showed Prisma 6 lowering counter writes to +database-side arithmetic: + +```sql +UPDATE "Link" +SET "clicks" = ("Link"."clicks" + $1), "lastClicked" = $2, "updatedAt" = $3 +WHERE ... +RETURNING ...; +``` + +The current Prisma Next SQL high-level ORM port cannot express that operation, +so the comparison script uses an application-side fallback: + +```sql +SELECT "Link"."clicks" FROM "Link" WHERE "Link"."id" = $1 LIMIT 1; +UPDATE "Link" +SET "clicks" = $1, "lastClicked" = $2, "updatedAt" = $3 +WHERE "Link"."id" = $4 +RETURNING ...; +``` + +That fallback matches the single-threaded fixture result, but it does not match +Prisma 6's concurrency semantics. It should be removed once SQL/Postgres +implements ADR 180-style field operations. + +Covered Dub cases that should move to the new API include: + +- `usage.update.link-click-increment`; +- `usage.update.workspace-clicks-increment`; +- `usage.update.workspace-links-increment`; +- `usage.update.program-enrollment-clicks-increment`. + +## Implementation Notes For Prisma Next + +The SQL/Postgres implementation should reuse the ADR 180 field-operation model +instead of adding a separate Prisma-6-shaped special case. + +The likely implementation path is: + +1. Add an update-callback overload to the SQL high-level ORM: + + ```ts + db.orm.Link.where({ id }).update((link) => [ + link.clicks.inc(1), + link.lastClicked.set(date), + ]); + ``` + +2. Expose a SQL field accessor with direct scalar properties and, where + applicable, callable dot-path access. +3. Gate `inc`, `mul`, and any `dec`/`div` aliases to numeric scalar fields and + to targets that can lower them correctly. +4. Lower field operations into update-assignment AST nodes, not into resolved + scalar values. +5. Extend the relational AST and SQL renderer if update assignments cannot + currently hold arithmetic expressions. +6. Encode operation operands through the field's write codec. +7. Compose ordinary `.set()` assignments, atomic operations, and `@updatedAt` + in one `UPDATE` whenever possible. +8. Keep `updateCount` count semantics and transaction shape compatible with + Prisma 6 when more than one dependent statement is required. + +Raw SQL remains a useful escape hatch, but it is not the target API for normal +Prisma Client parity. + +## Compatibility Tests To Add + +Prisma Next should have PostgreSQL tests for these cases: + +1. The SQL high-level ORM exposes an ADR 180-style update callback with field + operations. +2. A single `inc()` lowers to `column = column + $n` and returns the + post-update value. +3. A decrement operation lowers to database-side subtraction, either through + `inc(-n)` or a `dec(n)` alias. +4. `mul()` lowers to `column = column * $n`. +5. A divide operation lowers to `column = column / $n`. +6. Multiple atomic fields in one update lower to one `UPDATE` statement. +7. Atomic operations combine with ordinary scalar assignments in one `UPDATE`. +8. Atomic operations combine with implicit `@updatedAt` in one `UPDATE`. +9. Explicit `updatedAt` is preserved when an atomic operation is present. +10. A compound unique `where` filter keeps the arithmetic database-side. +11. `updateCount` with atomic operations updates all matching rows with + database-side arithmetic and returns the expected count. +12. `updateCount` with a required preliminary `SELECT` runs the dependent work + in one transaction. +13. Concurrent increments on the same row do not lose updates. For example, + start with `clicks = 0`, run 50 concurrent `inc(1)` mutations, then assert + that the stored value is `50`. +14. Concurrent multi-field increments keep both counters consistent. For + example, 50 concurrent updates with `usage += 3` and `totalClicks += 3` + should add `150` to both fields. +15. No-row `update` preserves Prisma-compatible not-found behavior. +16. Zero-match `updateCount` returns `0` and changes no state. +17. Type tests reject `inc()` and `mul()` on non-numeric fields. +18. Operand type tests preserve `BigInt` and `Decimal` input types instead of + forcing everything through `number`. + +The essential assertion is not only the final value. Captured SQL should prove +that Prisma Next implemented the operation as a high-level field operation +lowered to database-side arithmetic. diff --git a/docs/prisma-next-write-transactions.md b/docs/prisma-next-write-transactions.md new file mode 100644 index 00000000000..6c5b579c34d --- /dev/null +++ b/docs/prisma-next-write-transactions.md @@ -0,0 +1,403 @@ +# Prisma Next Write Transaction Expectations + +This document describes how I would expect Prisma Next to handle transaction +shape for multi-statement writes when matching Prisma 6 behavior on PostgreSQL. + +The short version: one Prisma mutation should commit as one unit. If Prisma +Next lowers one logical write into a dependent `SELECT` plus `UPDATE`, those +statements should run in one transaction, or Prisma Next should use a single +SQL statement instead. + +## Scope + +This applies to ORM write operations where Prisma Next cannot express the whole +mutation as one SQL statement and therefore emits dependent statements. + +Important examples: + +- `updateMany` +- `deleteMany` +- count-returning writes such as Prisma Next `updateCount` +- writes that first discover matching row IDs and then update or delete them +- future nested writes or relation writes that require several SQL statements + +This document does not require a transaction around every single SQL `UPDATE`. +If Prisma Next can lower a mutation to one SQL statement, the database already +executes that statement atomically. + +## Prisma 6 Observable Behavior + +In the Dub runtime comparison, this Prisma 6 call: + +```ts +await prisma.commission.updateMany({ + where: { + id: { + in: [commissionId], + }, + }, + data: { + payoutId: null, + status: "paid", + }, +}); +``` + +was captured as one transaction: + +```sql +BEGIN; + +SELECT "Commission"."id" +FROM "Commission" +WHERE "Commission"."id" IN ($1) +OFFSET $2; + +UPDATE "Commission" +SET + "payoutId" = $1, + "status" = CAST($2::text AS "CommissionStatus"), + "updatedAt" = $3 +WHERE "Commission"."id" IN ($4) + AND 1 = 1; + +COMMIT; +``` + +The exact SQL does not need to match byte for byte. The important observable +shape is that Prisma 6 treats the dependent `SELECT` and `UPDATE` as one +database transaction. + +## Required Transaction Boundary + +If a Prisma Next write needs multiple dependent statements, Prisma Next should +start a transaction before the first dependent statement and commit after the +last dependent statement. + +Expected shape: + +```sql +BEGIN; +SELECT ...; +UPDATE ...; +COMMIT; +``` + +or: + +```sql +BEGIN; +SELECT ...; +DELETE ...; +COMMIT; +``` + +If any dependent statement fails, Prisma Next should roll back the transaction: + +```sql +BEGIN; +SELECT ...; +UPDATE ...; -- fails +ROLLBACK; +``` + +Prisma Next should not lower one logical mutation to separate autocommit +statements: + +```sql +SELECT ...; -- committed immediately +UPDATE ...; -- committed separately +``` + +That shape changes the failure and concurrency contract of a Prisma write. + +## Why Autocommit Is Not Equivalent + +Autocommit creates a gap between the dependent statements. Other transactions +can update or delete the selected rows during that gap. + +For example: + +1. Prisma Next selects IDs for a logical `updateMany`. +2. Another request deletes one selected row. +3. Prisma Next updates by the old selected ID list. +4. Prisma Next returns a count based on stale selected IDs. + +A transaction does not make every race impossible under PostgreSQL's default +`READ COMMITTED` isolation. It does, however, make the dependent statements one +atomic unit for commit, rollback, connection state, and error handling. That is +the Prisma 6-compatible baseline. + +If Prisma Next needs stronger match-set stability than `READ COMMITTED` +provides, it should either: + +- lower to one `UPDATE ... WHERE ...` or `DELETE ... WHERE ...` statement; +- re-check the original predicate in the write statement; +- lock selected rows with an appropriate `FOR UPDATE`-style read; or +- run the transaction at an isolation level that matches the intended Prisma + behavior. + +The simplest compatible lowering is usually one SQL write statement with the +original predicate. + +## Prefer Single-Statement Writes + +When the mutation does not need a preliminary read, Prisma Next should prefer a +single SQL statement: + +```sql +UPDATE "Commission" +SET + "payoutId" = $1, + "status" = $2, + "updatedAt" = $3 +WHERE "Commission"."id" IN ($4); +``` + +For count-returning writes, PostgreSQL can return the affected row count for +that statement. Prisma Next does not need a separate `SELECT` only to count +matching rows if the `UPDATE` or `DELETE` result can provide the count. + +For writes that must return rows, PostgreSQL can often use `RETURNING`: + +```sql +UPDATE "Commission" +SET "status" = $1 +WHERE ... +RETURNING ...; +``` + +If Prisma Next can satisfy the API with one statement, no explicit transaction +is required for atomicity. + +## Count Semantics + +For `updateMany` and count-returning writes, Prisma Next should return the +number of rows affected by the logical Prisma mutation. + +Acceptable implementations: + +- use the affected-row count from one `UPDATE` or `DELETE`; +- use `UPDATE ... RETURNING` and count returned rows; +- use a transaction that locks or otherwise preserves the selected target set; +- use a transaction and derive the count from the actual write result. + +Risky implementation: + +```sql +SELECT id FROM "Commission" WHERE ...; +UPDATE "Commission" SET ... WHERE id IN (...); +``` + +then returning the number of rows from the `SELECT` while the `UPDATE` affects a +different number of rows. + +If Prisma Next preselects IDs, it should make the returned count match the rows +it actually updates or deletes. + +## Rollback Semantics + +If a multi-statement write partially succeeds and then fails, Prisma Next should +leave no partial database changes. + +Example: + +```sql +BEGIN; +UPDATE "Commission" SET "status" = $1 WHERE ...; +INSERT INTO "AuditLog" ...; -- fails +ROLLBACK; +``` + +After rollback, the `Commission` rows should retain their original state. + +This matters for future Prisma Next write expansions. Nested writes, relation +writes, and multi-table updates must not commit half of one logical Prisma +mutation. + +## Connection And Session State + +All statements inside one logical transaction should run on the same database +connection. + +That matters for: + +- transaction state; +- temporary settings such as transaction isolation; +- advisory locks if a future lowering uses them; +- consistent error handling; +- rollback. + +Prisma Next should not send the `SELECT` through one pooled connection and the +dependent `UPDATE` through another connection when those statements implement +one mutation. + +## Interaction With `@updatedAt` + +When a multi-row write touches a model with `@updatedAt`, the generated +timestamp should be part of the same logical mutation as the other updates. + +For one-statement lowerings: + +```sql +UPDATE "Commission" +SET + "status" = $1, + "updatedAt" = $2 +WHERE ...; +``` + +For multi-statement lowerings: + +```sql +BEGIN; +SELECT ...; +UPDATE "Commission" +SET + "status" = $1, + "updatedAt" = $2 +WHERE ...; +COMMIT; +``` + +Prisma Next should not generate `updatedAt`, commit some unrelated part of the +write, then fail before applying the rest of the mutation. + +## Interaction With Atomic Field Operations + +Atomic numeric operations, such as `increment`, should still lower to +database-side arithmetic. A transaction is not a substitute for database-side +arithmetic if Prisma Next first reads a value into JavaScript and then writes an +absolute replacement value. + +Wrong shape: + +```sql +BEGIN; +SELECT "Link"."clicks" FROM "Link" WHERE "Link"."id" = $1; +UPDATE "Link" SET "clicks" = $2 WHERE "Link"."id" = $3; +COMMIT; +``` + +Better shape: + +```sql +UPDATE "Link" +SET "clicks" = "Link"."clicks" + $1 +WHERE "Link"."id" = $2; +``` + +If Prisma Next needs a transaction for other reasons, the arithmetic update can +still run inside that transaction: + +```sql +BEGIN; +UPDATE "Link" +SET "clicks" = "Link"."clicks" + $1 +WHERE "Link"."id" = $2; +COMMIT; +``` + +See `docs/prisma-next-write-atomic-expectations.md` for the atomic field +operation contract. + +## Error Behavior + +Prisma Next should preserve Prisma-compatible error behavior for multi-statement +writes: + +- if the mutation fails before any write, no state changes; +- if the mutation fails after one write statement, the transaction rolls back; +- if zero rows match an `updateMany`, the result is `{ count: 0 }` and no state + changes; +- if a single-row `update` finds no row, Prisma-compatible not-found behavior + applies; +- if commit fails, Prisma Next should report failure and not claim the mutation + succeeded. + +The caller should not observe a half-applied Prisma mutation. + +## Acceptable Internal Differences + +These differences are acceptable if observable behavior matches Prisma 6: + +- one `UPDATE ... WHERE ...` instead of Prisma 6's `BEGIN` plus `SELECT` plus + `UPDATE` plus `COMMIT`; +- `UPDATE ... RETURNING` instead of a separate read; +- equivalent casts and placeholder ordering; +- a stricter transaction shape than Prisma 6 where needed for correctness; +- an explicit transaction around a single statement if Prisma Next's execution + layer requires it. + +These differences are not acceptable: + +- dependent `SELECT` and `UPDATE` statements in separate autocommit + transactions; +- returning a count based on stale preselected rows instead of affected rows; +- committing one part of a logical mutation before a later dependent statement + fails; +- running dependent transaction statements on different pooled connections; +- swallowing rollback or commit errors. + +## Dub Runtime Gap + +The latest Dub comparison showed this shape for Prisma 6: + +```sql +BEGIN; +SELECT "Commission"."id" ... +UPDATE "Commission" +SET "payoutId" = $1, "status" = $2, "updatedAt" = $3 +WHERE "Commission"."id" IN ($4); +COMMIT; +``` + +The current Prisma Next high-level `updateCount` path was captured as: + +```sql +SELECT "Commission"."id" AS "id" +FROM "Commission" +WHERE "Commission"."id" IN ($1); + +UPDATE "Commission" +SET "payoutId" = $1, "status" = $2, "updatedAt" = $3 +WHERE "Commission"."id" IN ($4); +``` + +The single-threaded fixture result matches, but the transaction shape does not. +If Prisma Next keeps the preliminary `SELECT`, it should wrap the dependent +statements in one transaction. If it can remove the `SELECT`, it should prefer a +single `UPDATE`. + +## Compatibility Tests To Add + +Prisma Next should have PostgreSQL tests for these cases: + +1. `updateMany` that lowers to multiple statements emits `BEGIN` before the + dependent `SELECT` and `COMMIT` after the dependent `UPDATE`. +2. If the dependent `UPDATE` fails, Prisma Next emits `ROLLBACK` and leaves no + partial changes. +3. If commit fails or the connection drops before commit, Prisma Next does not + report success. +4. A one-statement `updateMany` returns the affected-row count from the write + result. +5. A preselected-ID implementation returns a count that matches the rows + actually updated. +6. A row deleted between preselection and update does not produce a stale + success count. +7. A row that no longer matches the original predicate between preselection and + update is either not updated, or the behavior is explicitly matched to Prisma + 6 and covered by a test. +8. Multi-row writes with `@updatedAt` apply the timestamp inside the same + transaction. +9. Multi-statement nested writes roll back all changes if a later statement + fails. +10. Transaction statements run on one physical database connection. +11. Concurrent `updateMany` calls do not produce partial commits or stale + counts. +12. Explicit transaction APIs, if exposed by Prisma Next, preserve the same + all-or-nothing behavior when multiple ORM writes are composed by user code. + +The key assertion is not only the final fixture state. The SQL capture should +prove that dependent statements for one logical Prisma mutation are either one +SQL statement or one explicit transaction. diff --git a/package.json b/package.json index 78b89077fd6..4da851f39b1 100644 --- a/package.json +++ b/package.json @@ -32,5 +32,42 @@ "resolutions": { "chrono-node": "2.7.5" }, - "packageManager": "pnpm@9.15.9" + "packageManager": "pnpm@9.15.9", + "engines": { + "node": ">=24" + }, + "pnpm": { + "overrides": { + "@prisma-next/adapter-postgres": "file:packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz", + "@prisma-next/cli": "file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz", + "@prisma-next/config": "file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz", + "@prisma-next/contract": "file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz", + "@prisma-next/contract-authoring": "file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz", + "@prisma-next/driver-postgres": "file:packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz", + "@prisma-next/emitter": "file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz", + "@prisma-next/errors": "file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz", + "@prisma-next/family-sql": "file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz", + "@prisma-next/framework-components": "file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz", + "@prisma-next/ids": "file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz", + "@prisma-next/migration-tools": "file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz", + "@prisma-next/operations": "file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz", + "@prisma-next/postgres": "file:packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz", + "@prisma-next/psl-parser": "file:packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz", + "@prisma-next/psl-printer": "file:packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz", + "@prisma-next/sql-builder": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz", + "@prisma-next/sql-contract": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz", + "@prisma-next/sql-contract-emitter": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz", + "@prisma-next/sql-contract-psl": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz", + "@prisma-next/sql-contract-ts": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz", + "@prisma-next/sql-errors": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz", + "@prisma-next/sql-operations": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz", + "@prisma-next/sql-orm-client": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz", + "@prisma-next/sql-relational-core": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz", + "@prisma-next/sql-runtime": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz", + "@prisma-next/sql-schema-ir": "file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz", + "@prisma-next/target-postgres": "file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz", + "@prisma-next/ts-render": "file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz", + "@prisma-next/utils": "file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz" + } + } } diff --git a/packages/prisma/edge.ts b/packages/prisma/edge.ts index ce8bc545d59..2e45dd7184e 100644 --- a/packages/prisma/edge.ts +++ b/packages/prisma/edge.ts @@ -1,13 +1,14 @@ -import { Client } from "@planetscale/database"; -import { PrismaPlanetScale } from "@prisma/adapter-planetscale"; +import { PrismaPg } from "@prisma/adapter-pg"; import { PrismaClient } from "@prisma/client"; -const client = new Client({ - url: process.env.PLANETSCALE_DATABASE_URL || process.env.DATABASE_URL, -}); - -const adapter = new PrismaPlanetScale(client); +const databaseUrl = process.env.DATABASE_URL; export const prismaEdge = new PrismaClient({ - adapter, + ...(databaseUrl + ? { + adapter: new PrismaPg({ + connectionString: databaseUrl, + }), + } + : {}), }); diff --git a/packages/prisma/index.ts b/packages/prisma/index.ts index 2b30efb6ef6..83d96f49c3f 100644 --- a/packages/prisma/index.ts +++ b/packages/prisma/index.ts @@ -1,11 +1,24 @@ +import { PrismaPg } from "@prisma/adapter-pg"; import { PrismaClient } from "@prisma/client"; -const prismaClientSingleton = () => - new PrismaClient({ +const getPrismaOptions = () => { + const databaseUrl = process.env.DATABASE_URL; + + return { + ...(databaseUrl + ? { + adapter: new PrismaPg({ + connectionString: databaseUrl, + }), + } + : {}), omit: { user: { passwordHash: true }, }, - }); + }; +}; + +const prismaClientSingleton = () => new PrismaClient(getPrismaOptions()); type OmittedPrismaClient = ReturnType; diff --git a/packages/prisma/next.d.ts b/packages/prisma/next.d.ts new file mode 100644 index 00000000000..ed18ea16c75 --- /dev/null +++ b/packages/prisma/next.d.ts @@ -0,0 +1,8 @@ +import type postgres from "@prisma-next/postgres/runtime"; +import type { Contract } from "./schema/contract.d"; + +export declare const prismaNext: ReturnType>; +export declare const db: typeof prismaNext; + +export type { Contract } from "./schema/contract.d"; +export default prismaNext; diff --git a/packages/prisma/next.mjs b/packages/prisma/next.mjs new file mode 100644 index 00000000000..ef91bcfdeb1 --- /dev/null +++ b/packages/prisma/next.mjs @@ -0,0 +1,13 @@ +import postgres from "@prisma-next/postgres/runtime"; +import contractJson from "./schema/contract.json" with { type: "json" }; + +const databaseUrl = process.env.DATABASE_URL; + +export const prismaNext = postgres({ + contractJson, + ...(databaseUrl ? { url: databaseUrl } : {}), +}); + +export const db = prismaNext; + +export default prismaNext; diff --git a/packages/prisma/package.json b/packages/prisma/package.json index e9c24cbd96a..2fa0fed2614 100644 --- a/packages/prisma/package.json +++ b/packages/prisma/package.json @@ -6,19 +6,30 @@ "module": "./index.ts", "types": "./index.ts", "scripts": { - "generate": "npx prisma generate --schema=./schema", - "push": "npx prisma db push --schema=./schema", - "studio": "npx prisma studio --schema=./schema --browser none", + "generate": "tsx ./scripts/prisma6-cli.ts generate", + "push": "tsx ./scripts/prisma6-cli.ts db push", + "postdeploy:postgres": "tsx ./scripts/postdeploy-postgres.ts", + "studio": "tsx ./scripts/prisma6-cli.ts studio --browser none", "prebuild": "pnpm run generate", "predev": "pnpm run generate", - "format": "npx prisma format --schema=./schema" + "format": "tsx ./scripts/prisma6-cli.ts format", + "next:emit": "prisma-next contract emit --config ./prisma-next.config.ts && tsx ./scripts/prisma-next-normalize-contract.ts", + "next:smoke": "node ./scripts/prisma-next-smoke.mjs", + "next:ddl:compare": "tsx ./scripts/prisma-next-ddl-compare.ts", + "next:sql:compare": "node ./scripts/prisma-next-runtime-sql-compare.mjs", + "next:raw:inventory": "node ./scripts/prisma-next-raw-sql-inventory.mjs", + "next:validate": "pnpm run next:emit && pnpm run next:smoke && pnpm run next:ddl:compare" }, "dependencies": { - "@planetscale/database": "1.19.0", - "@prisma/adapter-planetscale": "6.19.1", - "@prisma/client": "6.19.1" + "@prisma/adapter-pg": "6.19.1", + "@prisma/client": "6.19.1", + "pg": "8.16.0", + "@prisma-next/postgres": "file:./vendor/prisma-next/prisma-next-postgres-0.0.1.tgz", + "@prisma-next/sql-orm-client": "file:./vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz" }, "devDependencies": { + "@prisma-next/cli": "file:./vendor/prisma-next/prisma-next-cli-0.0.1.tgz", + "@types/pg": "8.11.11", "@types/node": "18.11.9", "prisma": "6.19.1", "tsx": "^4.11.0", @@ -27,7 +38,11 @@ "exports": { ".": "./index.ts", "./edge": "./edge.ts", - "./client": "./client.ts" + "./client": "./client.ts", + "./next": { + "types": "./next.d.ts", + "default": "./next.mjs" + } }, "author": "Steven Tey ", "homepage": "https://dub.co", @@ -42,7 +57,7 @@ "dub", "dub.co", "prisma", - "planetscale" + "postgresql" ], "publishConfig": { "access": "public" diff --git a/packages/prisma/postgres-postdeploy.sql b/packages/prisma/postgres-postdeploy.sql new file mode 100644 index 00000000000..4e74b4a4e64 --- /dev/null +++ b/packages/prisma/postgres-postdeploy.sql @@ -0,0 +1,32 @@ +-- PostgreSQL indexes and extensions Prisma schema cannot express on 6.19.x. +-- Run this after `prisma db push` or after applying production DDL. + +CREATE EXTENSION IF NOT EXISTS pg_trgm; + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "Customer_email_trgm_idx" + ON "Customer" USING gin ("email" gin_trgm_ops) + WHERE "email" IS NOT NULL; + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "Customer_name_trgm_idx" + ON "Customer" USING gin ("name" gin_trgm_ops) + WHERE "name" IS NOT NULL; + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "Partner_email_trgm_idx" + ON "Partner" USING gin ("email" gin_trgm_ops) + WHERE "email" IS NOT NULL; + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "Partner_name_trgm_idx" + ON "Partner" USING gin ("name" gin_trgm_ops); + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "Partner_companyName_trgm_idx" + ON "Partner" USING gin ("companyName" gin_trgm_ops) + WHERE "companyName" IS NOT NULL; + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "PartnerReferral_email_trgm_idx" + ON "PartnerReferral" USING gin ("email" gin_trgm_ops); + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "PartnerReferral_name_trgm_idx" + ON "PartnerReferral" USING gin ("name" gin_trgm_ops); + +CREATE INDEX CONCURRENTLY IF NOT EXISTS "Link_url_trgm_idx" + ON "Link" USING gin ("url" gin_trgm_ops); diff --git a/packages/prisma/prisma-next.config.ts b/packages/prisma/prisma-next.config.ts new file mode 100644 index 00000000000..f6d5f922d7d --- /dev/null +++ b/packages/prisma/prisma-next.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from "@prisma-next/postgres/config"; + +export default defineConfig({ + contract: "./schema/contract.prisma", + ...(process.env.DATABASE_URL + ? { + db: { + connection: process.env.DATABASE_URL, + }, + } + : {}), +}); diff --git a/packages/prisma/schema/contract.d.ts b/packages/prisma/schema/contract.d.ts new file mode 100644 index 00000000000..48e92f00be3 --- /dev/null +++ b/packages/prisma/schema/contract.d.ts @@ -0,0 +1,19097 @@ +// ⚠️ GENERATED FILE - DO NOT EDIT +// This file is automatically generated by 'prisma-next contract emit'. +// To regenerate, run: prisma-next contract emit +import type { CodecTypes as PgTypes } from '@prisma-next/target-postgres/codec-types'; +import type { JsonValue } from '@prisma-next/target-postgres/codec-types'; +import type { Char } from '@prisma-next/target-postgres/codec-types'; +import type { Varchar } from '@prisma-next/target-postgres/codec-types'; +import type { Numeric } from '@prisma-next/target-postgres/codec-types'; +import type { Bit } from '@prisma-next/target-postgres/codec-types'; +import type { VarBit } from '@prisma-next/target-postgres/codec-types'; +import type { Timestamp } from '@prisma-next/target-postgres/codec-types'; +import type { Timestamptz } from '@prisma-next/target-postgres/codec-types'; +import type { Time } from '@prisma-next/target-postgres/codec-types'; +import type { Timetz } from '@prisma-next/target-postgres/codec-types'; +import type { Interval } from '@prisma-next/target-postgres/codec-types'; +import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma-next/adapter-postgres/operation-types'; + +import type { + ContractWithTypeMaps, + TypeMaps as TypeMapsType, +} from '@prisma-next/sql-contract/types'; +import type { + Contract as ContractType, + ExecutionHashBase, + ProfileHashBase, + StorageHashBase, +} from '@prisma-next/contract/types'; + +export type StorageHash = + StorageHashBase<'sha256:d5955b49f64edc75fda048b1ea4739cd32c093276785e3dec5ceefdc0dff3ba8'>; +export type ExecutionHash = + ExecutionHashBase<'sha256:01c316b3ac6cf360e880db365d1c2c4b0c432d821b9611bac3314dc36a53b240'>; +export type ProfileHash = + ProfileHashBase<'sha256:1a8dbe044289f30a1de958fe800cc5a8378b285d2e126a8c44b58864bac2c18e'>; + +export type CodecTypes = PgTypes; +export type LaneCodecTypes = CodecTypes; +export type QueryOperationTypes = PgAdapterQueryOps; +type DefaultLiteralValue = CodecId extends keyof CodecTypes + ? CodecTypes[CodecId]['output'] + : _Encoded; + +export type FieldOutputTypes = { + readonly Account: { + readonly id: Char<24>; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly type: CodecTypes['pg/text@1']['output']; + readonly provider: CodecTypes['pg/text@1']['output']; + readonly providerAccountId: CodecTypes['pg/text@1']['output']; + readonly refresh_token: CodecTypes['pg/text@1']['output'] | null; + readonly refresh_token_expires_in: CodecTypes['pg/int4@1']['output'] | null; + readonly access_token: CodecTypes['pg/text@1']['output'] | null; + readonly expires_at: CodecTypes['pg/int4@1']['output'] | null; + readonly token_type: CodecTypes['pg/text@1']['output'] | null; + readonly scope: CodecTypes['pg/text@1']['output'] | null; + readonly id_token: CodecTypes['pg/text@1']['output'] | null; + readonly session_state: CodecTypes['pg/text@1']['output'] | null; + }; + readonly ActivityLog: { + readonly id: Char<24>; + readonly workspaceId: CodecTypes['pg/text@1']['output']; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly parentResourceType: CodecTypes['pg/text@1']['output'] | null; + readonly parentResourceId: CodecTypes['pg/text@1']['output'] | null; + readonly resourceType: CodecTypes['pg/text@1']['output']; + readonly resourceId: CodecTypes['pg/text@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly action: CodecTypes['pg/text@1']['output']; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly batchId: CodecTypes['pg/text@1']['output'] | null; + readonly changeSet: CodecTypes['pg/jsonb@1']['output'] | null; + readonly createdAt: Timestamp<3>; + }; + readonly Bounty: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly workflowId: CodecTypes['pg/text@1']['output'] | null; + readonly name: CodecTypes['pg/text@1']['output']; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly type: 'performance' | 'submission'; + readonly startsAt: Timestamp<3>; + readonly endsAt: Timestamp<3> | null; + readonly submissionsOpenAt: Timestamp<3> | null; + readonly submissionFrequency: 'day' | 'week' | 'month' | null; + readonly maxSubmissions: CodecTypes['pg/int4@1']['output']; + readonly rewardAmount: CodecTypes['pg/int4@1']['output'] | null; + readonly rewardDescription: CodecTypes['pg/text@1']['output'] | null; + readonly performanceScope: 'new' | 'lifetime' | null; + readonly submissionRequirements: CodecTypes['pg/jsonb@1']['output'] | null; + readonly socialMetricsLastSyncedAt: Timestamp<3> | null; + readonly archivedAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly BountyGroup: { + readonly id: Char<24>; + readonly bountyId: CodecTypes['pg/text@1']['output']; + readonly groupId: CodecTypes['pg/text@1']['output']; + }; + readonly BountySubmission: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly bountyId: CodecTypes['pg/text@1']['output']; + readonly performanceCount: CodecTypes['pg/int8@1']['output'] | null; + readonly socialMetricCount: CodecTypes['pg/int4@1']['output'] | null; + readonly commissionId: CodecTypes['pg/text@1']['output'] | null; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly status: 'draft' | 'submitted' | 'approved' | 'rejected'; + readonly rejectionReason: + | 'invalidProof' + | 'duplicateSubmission' + | 'outOfTimeWindow' + | 'didNotMeetCriteria' + | 'other' + | null; + readonly rejectionNote: CodecTypes['pg/text@1']['output'] | null; + readonly files: CodecTypes['pg/jsonb@1']['output'] | null; + readonly urls: CodecTypes['pg/jsonb@1']['output'] | null; + readonly periodNumber: CodecTypes['pg/int4@1']['output']; + readonly socialMetricsLastSyncedAt: Timestamp<3> | null; + readonly completedAt: Timestamp<3> | null; + readonly reviewedAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Campaign: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly workflowId: CodecTypes['pg/text@1']['output'] | null; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly qstashMessageId: CodecTypes['pg/text@1']['output'] | null; + readonly type: 'marketing' | 'transactional'; + readonly status: 'draft' | 'active' | 'paused' | 'scheduled' | 'sending' | 'sent' | 'canceled'; + readonly name: CodecTypes['pg/text@1']['output']; + readonly subject: CodecTypes['pg/text@1']['output']; + readonly preview: CodecTypes['pg/text@1']['output'] | null; + readonly from: CodecTypes['pg/text@1']['output'] | null; + readonly bodyJson: CodecTypes['pg/json@1']['output']; + readonly scheduledAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly CampaignGroup: { + readonly id: Char<24>; + readonly campaignId: CodecTypes['pg/text@1']['output']; + readonly groupId: CodecTypes['pg/text@1']['output']; + }; + readonly Commission: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly rewardId: CodecTypes['pg/text@1']['output'] | null; + readonly linkId: CodecTypes['pg/text@1']['output'] | null; + readonly payoutId: CodecTypes['pg/text@1']['output'] | null; + readonly invoiceId: CodecTypes['pg/text@1']['output'] | null; + readonly customerId: CodecTypes['pg/text@1']['output'] | null; + readonly eventId: CodecTypes['pg/text@1']['output'] | null; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly type: 'click' | 'lead' | 'sale' | 'custom'; + readonly amount: CodecTypes['pg/int4@1']['output']; + readonly quantity: CodecTypes['pg/int4@1']['output']; + readonly earnings: CodecTypes['pg/int4@1']['output']; + readonly currency: CodecTypes['pg/text@1']['output']; + readonly status: + | 'pending' + | 'processed' + | 'paid' + | 'refunded' + | 'duplicate' + | 'fraud' + | 'canceled'; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Customer: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output'] | null; + readonly email: CodecTypes['pg/text@1']['output'] | null; + readonly avatar: CodecTypes['pg/text@1']['output'] | null; + readonly externalId: CodecTypes['pg/text@1']['output'] | null; + readonly stripeCustomerId: CodecTypes['pg/text@1']['output'] | null; + readonly linkId: CodecTypes['pg/text@1']['output'] | null; + readonly clickId: CodecTypes['pg/text@1']['output'] | null; + readonly clickedAt: Timestamp<3> | null; + readonly country: CodecTypes['pg/text@1']['output'] | null; + readonly sales: CodecTypes['pg/int4@1']['output']; + readonly saleAmount: CodecTypes['pg/int8@1']['output']; + readonly firstSaleAt: Timestamp<3> | null; + readonly subscriptionCanceledAt: Timestamp<3> | null; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly projectConnectId: CodecTypes['pg/text@1']['output'] | null; + readonly programId: CodecTypes['pg/text@1']['output'] | null; + readonly partnerId: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Dashboard: { + readonly id: Char<24>; + readonly linkId: CodecTypes['pg/text@1']['output'] | null; + readonly folderId: CodecTypes['pg/text@1']['output'] | null; + readonly projectId: CodecTypes['pg/text@1']['output'] | null; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly doIndex: CodecTypes['pg/bool@1']['output']; + readonly password: CodecTypes['pg/text@1']['output'] | null; + readonly showConversions: CodecTypes['pg/bool@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly DefaultDomains: { + readonly id: Char<24>; + readonly dubsh: CodecTypes['pg/bool@1']['output']; + readonly chatgpt: CodecTypes['pg/bool@1']['output']; + readonly sptifi: CodecTypes['pg/bool@1']['output']; + readonly gitnew: CodecTypes['pg/bool@1']['output']; + readonly callink: CodecTypes['pg/bool@1']['output']; + readonly amznid: CodecTypes['pg/bool@1']['output']; + readonly ggllink: CodecTypes['pg/bool@1']['output']; + readonly figpage: CodecTypes['pg/bool@1']['output']; + readonly loooooooong: CodecTypes['pg/bool@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + }; + readonly Discount: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly amount: CodecTypes['pg/int4@1']['output']; + readonly type: 'percentage' | 'flat'; + readonly maxDuration: CodecTypes['pg/int4@1']['output'] | null; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly couponId: CodecTypes['pg/text@1']['output'] | null; + readonly couponTestId: CodecTypes['pg/text@1']['output'] | null; + readonly autoProvisionEnabledAt: Timestamp<3> | null; + readonly provider: 'stripe' | 'shopify'; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly DiscountCode: { + readonly id: Char<24>; + readonly code: CodecTypes['pg/text@1']['output']; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly discountId: CodecTypes['pg/text@1']['output'] | null; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly linkId: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly DiscoveredPartner: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly starredAt: Timestamp<3> | null; + readonly ignoredAt: Timestamp<3> | null; + readonly invitedAt: Timestamp<3> | null; + readonly messagedAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Domain: { + readonly id: Char<24>; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly verified: CodecTypes['pg/bool@1']['output']; + readonly placeholder: CodecTypes['pg/text@1']['output'] | null; + readonly expiredUrl: CodecTypes['pg/text@1']['output'] | null; + readonly notFoundUrl: CodecTypes['pg/text@1']['output'] | null; + readonly primary: CodecTypes['pg/bool@1']['output']; + readonly archived: CodecTypes['pg/bool@1']['output']; + readonly lastChecked: Timestamp<3>; + readonly logo: CodecTypes['pg/text@1']['output'] | null; + readonly appleAppSiteAssociation: CodecTypes['pg/jsonb@1']['output'] | null; + readonly assetLinks: CodecTypes['pg/jsonb@1']['output'] | null; + readonly deepviewData: CodecTypes['pg/jsonb@1']['output'] | null; + readonly linkRetentionDays: CodecTypes['pg/int4@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output'] | null; + }; + readonly EmailDomain: { + readonly id: Char<24>; + readonly workspaceId: CodecTypes['pg/text@1']['output']; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly status: 'pending' | 'verified' | 'failed' | 'temporary_failure' | 'not_started'; + readonly resendDomainId: CodecTypes['pg/text@1']['output'] | null; + readonly lastChecked: Timestamp<3>; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly EmailVerificationToken: { + readonly id: Char<24>; + readonly identifier: CodecTypes['pg/text@1']['output']; + readonly token: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3>; + }; + readonly Folder: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly type: 'default' | 'mega'; + readonly accessLevel: 'read' | 'write' | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly FolderAccessRequest: { + readonly id: Char<24>; + readonly folderId: CodecTypes['pg/text@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + }; + readonly FolderUser: { + readonly id: Char<24>; + readonly folderId: CodecTypes['pg/text@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly role: 'owner' | 'editor' | 'viewer' | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly FraudAlert: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly reason: CodecTypes['pg/text@1']['output']; + readonly status: 'pending' | 'confirmed' | 'dismissed'; + readonly reviewedById: CodecTypes['pg/text@1']['output'] | null; + readonly reviewedAt: Timestamp<3> | null; + readonly reviewNote: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly FraudEvent: { + readonly id: Char<24>; + readonly fraudEventGroupId: CodecTypes['pg/text@1']['output']; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly linkId: CodecTypes['pg/text@1']['output'] | null; + readonly customerId: CodecTypes['pg/text@1']['output'] | null; + readonly eventId: CodecTypes['pg/text@1']['output'] | null; + readonly sourceProgramId: CodecTypes['pg/text@1']['output'] | null; + readonly hash: CodecTypes['pg/text@1']['output']; + readonly metadata: CodecTypes['pg/json@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly FraudEventGroup: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly type: + | 'customerEmailMatch' + | 'customerEmailSuspiciousDomain' + | 'referralSourceBanned' + | 'paidTrafficDetected' + | 'partnerCrossProgramBan' + | 'partnerDuplicateAccount'; + readonly lastEventAt: Timestamp<3> | null; + readonly eventCount: CodecTypes['pg/int4@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly resolutionReason: CodecTypes['pg/text@1']['output'] | null; + readonly resolvedAt: Timestamp<3> | null; + readonly status: 'pending' | 'resolved'; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly FraudRule: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly type: + | 'customerEmailMatch' + | 'customerEmailSuspiciousDomain' + | 'referralSourceBanned' + | 'paidTrafficDetected' + | 'partnerCrossProgramBan' + | 'partnerDuplicateAccount'; + readonly config: CodecTypes['pg/json@1']['output'] | null; + readonly disabledAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly InstalledIntegration: { + readonly id: Char<24>; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly integrationId: CodecTypes['pg/text@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly credentials: CodecTypes['pg/jsonb@1']['output'] | null; + readonly settings: CodecTypes['pg/jsonb@1']['output'] | null; + }; + readonly Integration: { + readonly id: Char<24>; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly name: CodecTypes['pg/text@1']['output']; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly readme: CodecTypes['pg/text@1']['output'] | null; + readonly developer: CodecTypes['pg/text@1']['output']; + readonly website: CodecTypes['pg/text@1']['output']; + readonly logo: CodecTypes['pg/text@1']['output'] | null; + readonly screenshots: CodecTypes['pg/jsonb@1']['output'] | null; + readonly verified: CodecTypes['pg/bool@1']['output']; + readonly installUrl: CodecTypes['pg/text@1']['output'] | null; + readonly guideUrl: CodecTypes['pg/text@1']['output'] | null; + readonly category: CodecTypes['pg/text@1']['output'] | null; + readonly comingSoon: CodecTypes['pg/bool@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Invoice: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output'] | null; + readonly workspaceId: CodecTypes['pg/text@1']['output']; + readonly number: CodecTypes['pg/text@1']['output'] | null; + readonly status: 'processing' | 'completed' | 'failed'; + readonly type: 'partnerPayout' | 'domainRenewal'; + readonly payoutMode: 'internal' | 'hybrid' | 'external'; + readonly paymentMethod: 'card' | 'ach' | 'ach_fast' | 'sepa' | 'acss' | null; + readonly amount: CodecTypes['pg/int4@1']['output']; + readonly fee: CodecTypes['pg/int4@1']['output']; + readonly total: CodecTypes['pg/int4@1']['output']; + readonly externalAmount: CodecTypes['pg/int4@1']['output']; + readonly receiptUrl: CodecTypes['pg/text@1']['output'] | null; + readonly failedReason: CodecTypes['pg/text@1']['output'] | null; + readonly registeredDomains: CodecTypes['pg/json@1']['output'] | null; + readonly stripeChargeMetadata: CodecTypes['pg/json@1']['output'] | null; + readonly failedAttempts: CodecTypes['pg/int4@1']['output']; + readonly createdAt: Timestamp<3>; + readonly paidAt: Timestamp<3> | null; + }; + readonly jackson_index: { + readonly id: CodecTypes['pg/int4@1']['output']; + readonly key: Varchar<250>; + readonly storeKey: Varchar<250>; + }; + readonly jackson_store: { + readonly key: Varchar<250>; + readonly value: CodecTypes['pg/text@1']['output']; + readonly iv: Varchar<64> | null; + readonly tag: Varchar<64> | null; + readonly namespace: Varchar<64> | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['output']; + readonly modifiedAt: CodecTypes['pg/timestamp@1']['output'] | null; + }; + readonly jackson_ttl: { + readonly key: Varchar<250>; + readonly expiresAt: CodecTypes['pg/int8@1']['output']; + }; + readonly Link: { + readonly id: Char<24>; + readonly domain: CodecTypes['pg/text@1']['output']; + readonly key: CodecTypes['pg/text@1']['output']; + readonly url: CodecTypes['pg/text@1']['output']; + readonly shortLink: Varchar<400>; + readonly archived: CodecTypes['pg/bool@1']['output']; + readonly expiresAt: Timestamp<3> | null; + readonly expiredUrl: CodecTypes['pg/text@1']['output'] | null; + readonly disabledAt: Timestamp<3> | null; + readonly password: CodecTypes['pg/text@1']['output'] | null; + readonly trackConversion: CodecTypes['pg/bool@1']['output']; + readonly proxy: CodecTypes['pg/bool@1']['output']; + readonly title: CodecTypes['pg/text@1']['output'] | null; + readonly description: Varchar<280> | null; + readonly image: CodecTypes['pg/text@1']['output'] | null; + readonly video: CodecTypes['pg/text@1']['output'] | null; + readonly utm_source: CodecTypes['pg/text@1']['output'] | null; + readonly utm_medium: CodecTypes['pg/text@1']['output'] | null; + readonly utm_campaign: CodecTypes['pg/text@1']['output'] | null; + readonly utm_term: CodecTypes['pg/text@1']['output'] | null; + readonly utm_content: CodecTypes['pg/text@1']['output'] | null; + readonly rewrite: CodecTypes['pg/bool@1']['output']; + readonly linkRetentionCleanupDisabledAt: Timestamp<3> | null; + readonly doIndex: CodecTypes['pg/bool@1']['output']; + readonly ios: CodecTypes['pg/text@1']['output'] | null; + readonly android: CodecTypes['pg/text@1']['output'] | null; + readonly geo: CodecTypes['pg/json@1']['output'] | null; + readonly testVariants: CodecTypes['pg/json@1']['output'] | null; + readonly testStartedAt: Timestamp<3> | null; + readonly testCompletedAt: Timestamp<3> | null; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly projectId: CodecTypes['pg/text@1']['output'] | null; + readonly folderId: CodecTypes['pg/text@1']['output'] | null; + readonly externalId: CodecTypes['pg/text@1']['output'] | null; + readonly tenantId: CodecTypes['pg/text@1']['output'] | null; + readonly publicStats: CodecTypes['pg/bool@1']['output']; + readonly clicks: CodecTypes['pg/int4@1']['output']; + readonly leads: CodecTypes['pg/int4@1']['output']; + readonly conversions: CodecTypes['pg/int4@1']['output']; + readonly sales: CodecTypes['pg/int4@1']['output']; + readonly saleAmount: CodecTypes['pg/int8@1']['output']; + readonly lastClicked: Timestamp<3> | null; + readonly lastLeadAt: Timestamp<3> | null; + readonly lastConversionAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly comments: CodecTypes['pg/text@1']['output'] | null; + readonly programId: CodecTypes['pg/text@1']['output'] | null; + readonly partnerId: CodecTypes['pg/text@1']['output'] | null; + readonly partnerGroupDefaultLinkId: CodecTypes['pg/text@1']['output'] | null; + }; + readonly LinkTag: { + readonly id: Char<24>; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly linkId: CodecTypes['pg/text@1']['output']; + readonly tagId: CodecTypes['pg/text@1']['output']; + }; + readonly LinkWebhook: { + readonly id: Char<24>; + readonly linkId: CodecTypes['pg/text@1']['output']; + readonly webhookId: CodecTypes['pg/text@1']['output']; + }; + readonly Message: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly senderUserId: CodecTypes['pg/text@1']['output']; + readonly senderPartnerId: CodecTypes['pg/text@1']['output'] | null; + readonly type: 'direct' | 'campaign'; + readonly subject: CodecTypes['pg/text@1']['output'] | null; + readonly text: CodecTypes['pg/text@1']['output']; + readonly readInApp: Timestamp<3> | null; + readonly readInEmail: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly NotificationEmail: { + readonly id: Char<24>; + readonly emailId: CodecTypes['pg/text@1']['output']; + readonly type: 'Message' | 'Bounty' | 'Campaign'; + readonly messageId: CodecTypes['pg/text@1']['output'] | null; + readonly bountyId: CodecTypes['pg/text@1']['output'] | null; + readonly campaignId: CodecTypes['pg/text@1']['output'] | null; + readonly programId: CodecTypes['pg/text@1']['output'] | null; + readonly partnerId: CodecTypes['pg/text@1']['output'] | null; + readonly recipientUserId: CodecTypes['pg/text@1']['output'] | null; + readonly deliveredAt: Timestamp<3> | null; + readonly openedAt: Timestamp<3> | null; + readonly bouncedAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + }; + readonly NotificationPreference: { + readonly id: Char<24>; + readonly projectUserId: CodecTypes['pg/text@1']['output']; + readonly linkUsageSummary: CodecTypes['pg/bool@1']['output']; + readonly domainConfigurationUpdates: CodecTypes['pg/bool@1']['output']; + readonly newPartnerSale: CodecTypes['pg/bool@1']['output']; + readonly newPartnerApplication: CodecTypes['pg/bool@1']['output']; + readonly pendingApplicationsSummary: CodecTypes['pg/bool@1']['output']; + readonly newBountySubmitted: CodecTypes['pg/bool@1']['output']; + readonly newMessageFromPartner: CodecTypes['pg/bool@1']['output']; + readonly fraudEventsSummary: CodecTypes['pg/bool@1']['output']; + }; + readonly OAuthApp: { + readonly id: Char<24>; + readonly integrationId: CodecTypes['pg/text@1']['output']; + readonly clientId: CodecTypes['pg/text@1']['output']; + readonly hashedClientSecret: CodecTypes['pg/text@1']['output']; + readonly partialClientSecret: CodecTypes['pg/text@1']['output']; + readonly redirectUris: CodecTypes['pg/jsonb@1']['output']; + readonly pkce: CodecTypes['pg/bool@1']['output']; + }; + readonly OAuthCode: { + readonly id: Char<24>; + readonly clientId: CodecTypes['pg/text@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly code: CodecTypes['pg/text@1']['output']; + readonly scopes: CodecTypes['pg/text@1']['output'] | null; + readonly redirectUri: CodecTypes['pg/text@1']['output']; + readonly codeChallenge: CodecTypes['pg/text@1']['output'] | null; + readonly codeChallengeMethod: CodecTypes['pg/text@1']['output'] | null; + readonly expiresAt: Timestamp<3>; + readonly createdAt: Timestamp<3>; + }; + readonly OAuthRefreshToken: { + readonly id: Char<24>; + readonly installationId: CodecTypes['pg/text@1']['output']; + readonly accessTokenId: CodecTypes['pg/text@1']['output']; + readonly hashedRefreshToken: CodecTypes['pg/text@1']['output']; + readonly expiresAt: Timestamp<3>; + readonly createdAt: Timestamp<3>; + }; + readonly Partner: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly username: CodecTypes['pg/text@1']['output'] | null; + readonly companyName: CodecTypes['pg/text@1']['output'] | null; + readonly profileType: 'individual' | 'company'; + readonly email: CodecTypes['pg/text@1']['output'] | null; + readonly image: CodecTypes['pg/text@1']['output'] | null; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly country: CodecTypes['pg/text@1']['output'] | null; + readonly identityVerificationStatus: + | 'started' + | 'submitted' + | 'approved' + | 'declined' + | 'resubmissionRequested' + | 'expired' + | 'abandoned' + | 'review' + | null; + readonly identityVerifiedAt: Timestamp<3> | null; + readonly veriffSessionId: CodecTypes['pg/text@1']['output'] | null; + readonly veriffMetadata: CodecTypes['pg/jsonb@1']['output'] | null; + readonly defaultPayoutMethod: 'connect' | 'stablecoin' | 'paypal' | null; + readonly payoutsEnabledAt: Timestamp<3> | null; + readonly connectPayoutsLastRemindedAt: Timestamp<3> | null; + readonly paypalEmail: CodecTypes['pg/text@1']['output'] | null; + readonly stripeConnectId: CodecTypes['pg/text@1']['output'] | null; + readonly stripeRecipientId: CodecTypes['pg/text@1']['output'] | null; + readonly payoutMethodHash: CodecTypes['pg/text@1']['output'] | null; + readonly cryptoWalletAddress: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly discoverableAt: Timestamp<3> | null; + readonly trustedAt: Timestamp<3> | null; + readonly invoiceSettings: CodecTypes['pg/jsonb@1']['output'] | null; + readonly changeHistoryLog: CodecTypes['pg/jsonb@1']['output'] | null; + readonly referredByPartnerId: CodecTypes['pg/text@1']['output'] | null; + readonly monthlyTraffic: + | 'ZeroToOneThousand' + | 'OneThousandToTenThousand' + | 'TenThousandToFiftyThousand' + | 'FiftyThousandToOneHundredThousand' + | 'OneHundredThousandPlus' + | null; + }; + readonly PartnerComment: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly text: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly PartnerGroup: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly name: CodecTypes['pg/text@1']['output']; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly color: CodecTypes['pg/text@1']['output'] | null; + readonly clickRewardId: CodecTypes['pg/text@1']['output'] | null; + readonly leadRewardId: CodecTypes['pg/text@1']['output'] | null; + readonly saleRewardId: CodecTypes['pg/text@1']['output'] | null; + readonly discountId: CodecTypes['pg/text@1']['output'] | null; + readonly linkStructure: 'short' | 'query' | 'path'; + readonly additionalLinks: CodecTypes['pg/json@1']['output'] | null; + readonly maxPartnerLinks: CodecTypes['pg/int4@1']['output']; + readonly applicationFormData: CodecTypes['pg/json@1']['output'] | null; + readonly applicationFormPublishedAt: Timestamp<3> | null; + readonly landerData: CodecTypes['pg/json@1']['output'] | null; + readonly landerPublishedAt: Timestamp<3> | null; + readonly logo: CodecTypes['pg/text@1']['output'] | null; + readonly wordmark: CodecTypes['pg/text@1']['output'] | null; + readonly brandColor: CodecTypes['pg/text@1']['output'] | null; + readonly holdingPeriodDays: CodecTypes['pg/int4@1']['output']; + readonly autoApprovePartnersEnabledAt: Timestamp<3> | null; + readonly workflowId: CodecTypes['pg/text@1']['output'] | null; + readonly utmTemplateId: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly PartnerGroupDefaultLink: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly groupId: CodecTypes['pg/text@1']['output']; + readonly domain: CodecTypes['pg/text@1']['output']; + readonly url: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly PartnerIndustryInterest: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly industryInterest: + | 'SaaS' + | 'DevTool' + | 'AI' + | 'Creative_And_Design' + | 'Productivity_Software' + | 'Marketing' + | 'Gaming' + | 'Finance' + | 'Sales' + | 'Ecommerce' + | 'Customer_Service_And_Support' + | 'Content_Management' + | 'Human_Resources' + | 'Security' + | 'Analytics_And_Data' + | 'Social_Media' + | 'Consumer_Tech' + | 'Education_And_Learning' + | 'Health_And_Fitness' + | 'Food_And_Beverage' + | 'Travel_And_Lifestyle' + | 'Entertainment_And_Media' + | 'Sports' + | 'Science_And_Engineering'; + }; + readonly PartnerInvite: { + readonly id: Char<24>; + readonly email: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly role: 'owner' | 'member'; + readonly createdAt: Timestamp<3>; + }; + readonly PartnerNotificationPreferences: { + readonly id: Char<24>; + readonly partnerUserId: CodecTypes['pg/text@1']['output']; + readonly commissionCreated: CodecTypes['pg/bool@1']['output']; + readonly applicationApproved: CodecTypes['pg/bool@1']['output']; + readonly newMessageFromProgram: CodecTypes['pg/bool@1']['output']; + readonly marketingCampaign: CodecTypes['pg/bool@1']['output']; + readonly connectPayoutReminder: CodecTypes['pg/bool@1']['output']; + readonly monthlyProgramSummary: CodecTypes['pg/bool@1']['output']; + }; + readonly PartnerPlatform: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly type: 'website' | 'youtube' | 'twitter' | 'linkedin' | 'instagram' | 'tiktok'; + readonly identifier: CodecTypes['pg/text@1']['output']; + readonly platformId: CodecTypes['pg/text@1']['output'] | null; + readonly avatarUrl: CodecTypes['pg/text@1']['output'] | null; + readonly subscribers: CodecTypes['pg/int8@1']['output']; + readonly posts: CodecTypes['pg/int8@1']['output']; + readonly views: CodecTypes['pg/int8@1']['output']; + readonly metadata: CodecTypes['pg/jsonb@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly verifiedAt: Timestamp<3> | null; + readonly lastCheckedAt: Timestamp<3> | null; + }; + readonly PartnerPreferredEarningStructure: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly preferredEarningStructure: + | 'Revenue_Share' + | 'Per_Lead' + | 'Per_Sale' + | 'Per_Click' + | 'One_Time_Payment'; + }; + readonly PartnerReferral: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly customerId: CodecTypes['pg/text@1']['output'] | null; + readonly name: CodecTypes['pg/text@1']['output']; + readonly email: CodecTypes['pg/text@1']['output']; + readonly company: CodecTypes['pg/text@1']['output']; + readonly formData: CodecTypes['pg/json@1']['output'] | null; + readonly status: + | 'pending' + | 'qualified' + | 'meeting' + | 'negotiation' + | 'unqualified' + | 'closedWon' + | 'closedLost'; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly PartnerRewind: { + readonly id: Char<24>; + readonly year: CodecTypes['pg/int4@1']['output']; + readonly totalClicks: CodecTypes['pg/int4@1']['output']; + readonly totalLeads: CodecTypes['pg/int4@1']['output']; + readonly totalRevenue: CodecTypes['pg/int4@1']['output']; + readonly totalEarnings: CodecTypes['pg/int4@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly sentAt: Timestamp<3> | null; + }; + readonly PartnerSalesChannel: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly salesChannel: + | 'Blogs' + | 'Coupons' + | 'Direct_Reselling' + | 'Newsletters' + | 'Social_Media' + | 'Events' + | 'Company_Referrals'; + }; + readonly PartnerUser: { + readonly id: Char<24>; + readonly role: 'owner' | 'member'; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly PasswordResetToken: { + readonly id: Char<24>; + readonly identifier: CodecTypes['pg/text@1']['output']; + readonly token: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3>; + }; + readonly Payout: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly invoiceId: CodecTypes['pg/text@1']['output'] | null; + readonly amount: CodecTypes['pg/int4@1']['output']; + readonly currency: CodecTypes['pg/text@1']['output']; + readonly status: + | 'pending' + | 'processing' + | 'processed' + | 'sent' + | 'completed' + | 'failed' + | 'canceled'; + readonly mode: 'internal' | 'external' | null; + readonly method: 'connect' | 'stablecoin' | 'paypal' | null; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly periodStart: Timestamp<3> | null; + readonly periodEnd: Timestamp<3> | null; + readonly paypalTransferId: CodecTypes['pg/text@1']['output'] | null; + readonly stripeTransferId: CodecTypes['pg/text@1']['output'] | null; + readonly stripePayoutId: CodecTypes['pg/text@1']['output'] | null; + readonly stripePayoutTraceId: CodecTypes['pg/text@1']['output'] | null; + readonly failureReason: CodecTypes['pg/text@1']['output'] | null; + readonly webhookEventId: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly initiatedAt: Timestamp<3> | null; + readonly paidAt: Timestamp<3> | null; + }; + readonly Postback: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly name: CodecTypes['pg/text@1']['output']; + readonly url: CodecTypes['pg/text@1']['output']; + readonly secret: CodecTypes['pg/text@1']['output']; + readonly triggers: CodecTypes['pg/jsonb@1']['output']; + readonly receiver: 'custom' | 'slack'; + readonly disabledAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Program: { + readonly id: Char<24>; + readonly workspaceId: CodecTypes['pg/text@1']['output']; + readonly defaultFolderId: CodecTypes['pg/text@1']['output']; + readonly defaultGroupId: CodecTypes['pg/text@1']['output']; + readonly name: CodecTypes['pg/text@1']['output']; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly domain: CodecTypes['pg/text@1']['output'] | null; + readonly url: CodecTypes['pg/text@1']['output'] | null; + readonly logo: CodecTypes['pg/text@1']['output'] | null; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly primaryRewardEvent: 'click' | 'lead' | 'sale'; + readonly minPayoutAmount: CodecTypes['pg/int4@1']['output']; + readonly payoutMode: 'internal' | 'hybrid' | 'external'; + readonly inviteEmailData: CodecTypes['pg/json@1']['output'] | null; + readonly embedData: CodecTypes['pg/json@1']['output'] | null; + readonly resources: CodecTypes['pg/json@1']['output'] | null; + readonly referralFormData: CodecTypes['pg/json@1']['output'] | null; + readonly applicationRequirements: CodecTypes['pg/json@1']['output'] | null; + readonly termsUrl: CodecTypes['pg/text@1']['output'] | null; + readonly helpUrl: CodecTypes['pg/text@1']['output'] | null; + readonly supportEmail: CodecTypes['pg/text@1']['output'] | null; + readonly messagingEnabledAt: Timestamp<3> | null; + readonly partnerNetworkEnabledAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly startedAt: Timestamp<3> | null; + readonly deactivatedAt: Timestamp<3> | null; + readonly addedToMarketplaceAt: Timestamp<3> | null; + readonly featuredOnMarketplaceAt: Timestamp<3> | null; + readonly marketplaceHeaderImage: CodecTypes['pg/text@1']['output'] | null; + readonly marketplaceRanking: CodecTypes['pg/int4@1']['output']; + }; + readonly ProgramApplication: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly groupId: CodecTypes['pg/text@1']['output'] | null; + readonly name: CodecTypes['pg/text@1']['output']; + readonly email: CodecTypes['pg/text@1']['output']; + readonly country: CodecTypes['pg/text@1']['output'] | null; + readonly website: CodecTypes['pg/text@1']['output'] | null; + readonly youtube: CodecTypes['pg/text@1']['output'] | null; + readonly twitter: CodecTypes['pg/text@1']['output'] | null; + readonly linkedin: CodecTypes['pg/text@1']['output'] | null; + readonly instagram: CodecTypes['pg/text@1']['output'] | null; + readonly tiktok: CodecTypes['pg/text@1']['output'] | null; + readonly formData: CodecTypes['pg/json@1']['output'] | null; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly rejectionReason: + | 'needsMoreDetail' + | 'doesNotMeetRequirements' + | 'notTheRightFit' + | 'other' + | null; + readonly rejectionNote: CodecTypes['pg/text@1']['output'] | null; + readonly reviewedAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly ProgramApplicationEvent: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly visitedAt: Timestamp<3>; + readonly startedAt: Timestamp<3> | null; + readonly submittedAt: Timestamp<3> | null; + readonly approvedAt: Timestamp<3> | null; + readonly rejectedAt: Timestamp<3> | null; + readonly country: CodecTypes['pg/text@1']['output'] | null; + readonly referralSource: CodecTypes['pg/text@1']['output']; + readonly referredByPartnerId: CodecTypes['pg/text@1']['output'] | null; + readonly metadata: CodecTypes['pg/json@1']['output'] | null; + readonly programApplicationId: CodecTypes['pg/text@1']['output'] | null; + readonly partnerId: CodecTypes['pg/text@1']['output'] | null; + }; + readonly ProgramCategory: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly category: + | 'Artificial_Intelligence' + | 'Development' + | 'Design' + | 'Productivity' + | 'Finance' + | 'Marketing' + | 'Ecommerce' + | 'Security' + | 'Education' + | 'Health' + | 'Consumer'; + }; + readonly ProgramEnrollment: { + readonly id: Char<24>; + readonly partnerId: CodecTypes['pg/text@1']['output']; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly tenantId: CodecTypes['pg/text@1']['output'] | null; + readonly groupId: CodecTypes['pg/text@1']['output'] | null; + readonly applicationId: CodecTypes['pg/text@1']['output'] | null; + readonly clickRewardId: CodecTypes['pg/text@1']['output'] | null; + readonly leadRewardId: CodecTypes['pg/text@1']['output'] | null; + readonly saleRewardId: CodecTypes['pg/text@1']['output'] | null; + readonly discountId: CodecTypes['pg/text@1']['output'] | null; + readonly status: + | 'pending' + | 'approved' + | 'rejected' + | 'invited' + | 'declined' + | 'deactivated' + | 'banned' + | 'archived'; + readonly totalClicks: CodecTypes['pg/int4@1']['output']; + readonly totalLeads: CodecTypes['pg/int4@1']['output']; + readonly totalConversions: CodecTypes['pg/int4@1']['output']; + readonly totalSales: CodecTypes['pg/int4@1']['output']; + readonly totalSaleAmount: CodecTypes['pg/int8@1']['output']; + readonly totalCommissions: CodecTypes['pg/int8@1']['output']; + readonly netRevenue: CodecTypes['pg/int8@1']['output']; + readonly earningsPerClick: CodecTypes['pg/float8@1']['output']; + readonly averageLifetimeValue: CodecTypes['pg/float8@1']['output'] | null; + readonly clickToLeadRate: CodecTypes['pg/float8@1']['output'] | null; + readonly clickToConversionRate: CodecTypes['pg/float8@1']['output'] | null; + readonly leadToConversionRate: CodecTypes['pg/float8@1']['output'] | null; + readonly returnOnAdSpend: CodecTypes['pg/float8@1']['output'] | null; + readonly lastConversionAt: Timestamp<3> | null; + readonly daysSinceLastConversion: CodecTypes['pg/int4@1']['output'] | null; + readonly consistencyScore: CodecTypes['pg/int4@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly customerDataSharingEnabledAt: Timestamp<3> | null; + readonly groupMoveDisabledAt: Timestamp<3> | null; + readonly bannedAt: Timestamp<3> | null; + readonly bannedReason: + | 'tos_violation' + | 'inappropriate_content' + | 'fake_traffic' + | 'fraud' + | 'spam' + | 'brand_abuse' + | null; + }; + readonly ProgramSimilarity: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly similarProgramId: CodecTypes['pg/text@1']['output']; + readonly similarityScore: CodecTypes['pg/float8@1']['output']; + readonly categorySimilarityScore: CodecTypes['pg/float8@1']['output']; + readonly partnerSimilarityScore: CodecTypes['pg/float8@1']['output']; + readonly performanceSimilarityScore: CodecTypes['pg/float8@1']['output']; + }; + readonly Project: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly logo: CodecTypes['pg/text@1']['output'] | null; + readonly inviteCode: CodecTypes['pg/text@1']['output'] | null; + readonly defaultProgramId: CodecTypes['pg/text@1']['output'] | null; + readonly plan: CodecTypes['pg/text@1']['output']; + readonly planTier: CodecTypes['pg/int4@1']['output']; + readonly planPeriod: 'monthly' | 'yearly' | 'quarterly' | 'biweekly' | null; + readonly stripeId: CodecTypes['pg/text@1']['output'] | null; + readonly billingCycleStart: CodecTypes['pg/int4@1']['output']; + readonly billingCycleEndsAt: Timestamp<3> | null; + readonly trialEndsAt: Timestamp<3> | null; + readonly subscriptionCanceledAt: Timestamp<3> | null; + readonly paymentFailedAt: Timestamp<3> | null; + readonly invoicePrefix: CodecTypes['pg/text@1']['output'] | null; + readonly stripeConnectId: CodecTypes['pg/text@1']['output'] | null; + readonly shopifyStoreId: CodecTypes['pg/text@1']['output'] | null; + readonly totalLinks: CodecTypes['pg/int4@1']['output']; + readonly totalClicks: CodecTypes['pg/int4@1']['output']; + readonly usage: CodecTypes['pg/int4@1']['output']; + readonly usageLimit: CodecTypes['pg/int4@1']['output']; + readonly linksUsage: CodecTypes['pg/int4@1']['output']; + readonly linksLimit: CodecTypes['pg/int4@1']['output']; + readonly payoutsUsage: CodecTypes['pg/int4@1']['output']; + readonly payoutsLimit: CodecTypes['pg/int4@1']['output']; + readonly payoutFee: CodecTypes['pg/float8@1']['output']; + readonly payoutFeeWaiverLimit: CodecTypes['pg/int4@1']['output']; + readonly payoutFeeWaiverUsage: CodecTypes['pg/int4@1']['output']; + readonly domainsLimit: CodecTypes['pg/int4@1']['output']; + readonly tagsLimit: CodecTypes['pg/int4@1']['output']; + readonly foldersUsage: CodecTypes['pg/int4@1']['output']; + readonly foldersLimit: CodecTypes['pg/int4@1']['output']; + readonly partnersUsage: CodecTypes['pg/int4@1']['output']; + readonly partnersLimit: CodecTypes['pg/int4@1']['output']; + readonly groupsLimit: CodecTypes['pg/int4@1']['output']; + readonly usersLimit: CodecTypes['pg/int4@1']['output']; + readonly aiUsage: CodecTypes['pg/int4@1']['output']; + readonly aiLimit: CodecTypes['pg/int4@1']['output']; + readonly networkInvitesLimit: CodecTypes['pg/int4@1']['output']; + readonly referralLinkId: CodecTypes['pg/text@1']['output'] | null; + readonly referredSignups: CodecTypes['pg/int4@1']['output']; + readonly store: CodecTypes['pg/jsonb@1']['output'] | null; + readonly siteVisitTrackingSettings: CodecTypes['pg/jsonb@1']['output'] | null; + readonly allowedHostnames: CodecTypes['pg/jsonb@1']['output'] | null; + readonly publishableKey: CodecTypes['pg/text@1']['output'] | null; + readonly conversionEnabled: CodecTypes['pg/bool@1']['output']; + readonly webhookEnabled: CodecTypes['pg/bool@1']['output']; + readonly dotLinkClaimed: CodecTypes['pg/bool@1']['output']; + readonly fastDirectDebitPayouts: CodecTypes['pg/bool@1']['output']; + readonly ssoEmailDomain: CodecTypes['pg/text@1']['output'] | null; + readonly ssoEnforcedAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly usageLastChecked: Timestamp<3>; + }; + readonly ProjectInvite: { + readonly id: Char<24>; + readonly email: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3>; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly role: 'owner' | 'member' | 'viewer' | 'billing'; + readonly createdAt: Timestamp<3>; + }; + readonly ProjectUsers: { + readonly id: Char<24>; + readonly role: 'owner' | 'member' | 'viewer' | 'billing'; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly workspacePreferences: CodecTypes['pg/jsonb@1']['output'] | null; + readonly defaultFolderId: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly RegisteredDomain: { + readonly id: Char<24>; + readonly slug: CodecTypes['pg/text@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly domainId: CodecTypes['pg/text@1']['output'] | null; + readonly autoRenewalDisabledAt: Timestamp<3> | null; + readonly renewalFee: CodecTypes['pg/int4@1']['output']; + readonly expiresAt: Timestamp<3>; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly RestrictedToken: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly hashedKey: CodecTypes['pg/text@1']['output']; + readonly partialKey: CodecTypes['pg/text@1']['output']; + readonly scopes: CodecTypes['pg/text@1']['output'] | null; + readonly expires: Timestamp<3> | null; + readonly lastUsed: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly installationId: CodecTypes['pg/text@1']['output'] | null; + }; + readonly Reward: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly description: CodecTypes['pg/text@1']['output'] | null; + readonly tooltipDescription: CodecTypes['pg/text@1']['output'] | null; + readonly event: 'click' | 'lead' | 'sale'; + readonly type: 'percentage' | 'flat'; + readonly amountInCents: CodecTypes['pg/int4@1']['output'] | null; + readonly amountInPercentage: Numeric<5, 2> | null; + readonly maxDuration: CodecTypes['pg/int4@1']['output'] | null; + readonly modifiers: CodecTypes['pg/json@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly SentEmail: { + readonly id: Char<24>; + readonly type: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly projectId: CodecTypes['pg/text@1']['output'] | null; + }; + readonly Session: { + readonly id: Char<24>; + readonly sessionToken: CodecTypes['pg/text@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3>; + }; + readonly Tag: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly color: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly projectId: CodecTypes['pg/text@1']['output']; + }; + readonly Token: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly hashedKey: CodecTypes['pg/text@1']['output']; + readonly partialKey: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3> | null; + readonly lastUsed: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + readonly userId: CodecTypes['pg/text@1']['output']; + }; + readonly User: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output'] | null; + readonly email: CodecTypes['pg/text@1']['output'] | null; + readonly emailVerified: Timestamp<3> | null; + readonly image: CodecTypes['pg/text@1']['output'] | null; + readonly isMachine: CodecTypes['pg/bool@1']['output']; + readonly createdAt: Timestamp<3>; + readonly passwordHash: CodecTypes['pg/text@1']['output'] | null; + readonly invalidLoginAttempts: CodecTypes['pg/int4@1']['output']; + readonly lockedAt: Timestamp<3> | null; + readonly defaultWorkspace: CodecTypes['pg/text@1']['output'] | null; + readonly defaultPartnerId: CodecTypes['pg/text@1']['output'] | null; + readonly source: CodecTypes['pg/text@1']['output'] | null; + readonly sentMail: CodecTypes['pg/bool@1']['output']; + }; + readonly UserNotificationPreferences: { + readonly id: Char<24>; + readonly userId: CodecTypes['pg/text@1']['output']; + readonly dubLinks: CodecTypes['pg/bool@1']['output']; + readonly dubPartners: CodecTypes['pg/bool@1']['output']; + readonly partnerAccount: CodecTypes['pg/bool@1']['output']; + }; + readonly UtmTemplate: { + readonly id: Char<24>; + readonly name: CodecTypes['pg/text@1']['output']; + readonly utm_source: CodecTypes['pg/text@1']['output'] | null; + readonly utm_medium: CodecTypes['pg/text@1']['output'] | null; + readonly utm_campaign: CodecTypes['pg/text@1']['output'] | null; + readonly utm_term: CodecTypes['pg/text@1']['output'] | null; + readonly utm_content: CodecTypes['pg/text@1']['output'] | null; + readonly ref: CodecTypes['pg/text@1']['output'] | null; + readonly userId: CodecTypes['pg/text@1']['output'] | null; + readonly projectId: CodecTypes['pg/text@1']['output'] | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly VerificationToken: { + readonly id: Char<24>; + readonly identifier: CodecTypes['pg/text@1']['output']; + readonly token: CodecTypes['pg/text@1']['output']; + readonly expires: Timestamp<3>; + }; + readonly Webhook: { + readonly id: Char<24>; + readonly projectId: CodecTypes['pg/text@1']['output']; + readonly installationId: CodecTypes['pg/text@1']['output'] | null; + readonly receiver: 'user' | 'zapier' | 'make' | 'slack' | 'segment'; + readonly name: CodecTypes['pg/text@1']['output']; + readonly url: CodecTypes['pg/text@1']['output']; + readonly secret: CodecTypes['pg/text@1']['output']; + readonly triggers: CodecTypes['pg/jsonb@1']['output']; + readonly consecutiveFailures: CodecTypes['pg/int4@1']['output']; + readonly lastFailedAt: Timestamp<3> | null; + readonly disabledAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly Workflow: { + readonly id: Char<24>; + readonly programId: CodecTypes['pg/text@1']['output']; + readonly name: CodecTypes['pg/text@1']['output'] | null; + readonly trigger: + | 'partnerEnrolled' + | 'partnerMetricsUpdated' + | 'clickRecorded' + | 'commissionEarned' + | 'leadRecorded' + | 'saleRecorded'; + readonly triggerConditions: CodecTypes['pg/jsonb@1']['output']; + readonly actions: CodecTypes['pg/jsonb@1']['output']; + readonly disabledAt: Timestamp<3> | null; + readonly createdAt: Timestamp<3>; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['output']; + }; + readonly YearInReview: { + readonly id: Char<24>; + readonly year: CodecTypes['pg/int4@1']['output']; + readonly totalLinks: CodecTypes['pg/int4@1']['output']; + readonly totalClicks: CodecTypes['pg/int4@1']['output']; + readonly topLinks: CodecTypes['pg/jsonb@1']['output']; + readonly topCountries: CodecTypes['pg/jsonb@1']['output']; + readonly workspaceId: CodecTypes['pg/text@1']['output']; + readonly createdAt: Timestamp<3>; + readonly sentAt: Timestamp<3> | null; + }; +}; +export type FieldInputTypes = { + readonly Account: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly type: CodecTypes['pg/text@1']['input']; + readonly provider: CodecTypes['pg/text@1']['input']; + readonly providerAccountId: CodecTypes['pg/text@1']['input']; + readonly refresh_token: CodecTypes['pg/text@1']['input'] | null; + readonly refresh_token_expires_in: CodecTypes['pg/int4@1']['input'] | null; + readonly access_token: CodecTypes['pg/text@1']['input'] | null; + readonly expires_at: CodecTypes['pg/int4@1']['input'] | null; + readonly token_type: CodecTypes['pg/text@1']['input'] | null; + readonly scope: CodecTypes['pg/text@1']['input'] | null; + readonly id_token: CodecTypes['pg/text@1']['input'] | null; + readonly session_state: CodecTypes['pg/text@1']['input'] | null; + }; + readonly ActivityLog: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly workspaceId: CodecTypes['pg/text@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly parentResourceType: CodecTypes['pg/text@1']['input'] | null; + readonly parentResourceId: CodecTypes['pg/text@1']['input'] | null; + readonly resourceType: CodecTypes['pg/text@1']['input']; + readonly resourceId: CodecTypes['pg/text@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly action: CodecTypes['pg/text@1']['input']; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly batchId: CodecTypes['pg/text@1']['input'] | null; + readonly changeSet: CodecTypes['pg/jsonb@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly Bounty: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly workflowId: CodecTypes['pg/text@1']['input'] | null; + readonly name: CodecTypes['pg/text@1']['input']; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly startsAt: CodecTypes['pg/timestamp@1']['input']; + readonly endsAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly submissionsOpenAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly submissionFrequency: CodecTypes['pg/enum@1']['input'] | null; + readonly maxSubmissions: CodecTypes['pg/int4@1']['input']; + readonly rewardAmount: CodecTypes['pg/int4@1']['input'] | null; + readonly rewardDescription: CodecTypes['pg/text@1']['input'] | null; + readonly performanceScope: CodecTypes['pg/enum@1']['input'] | null; + readonly submissionRequirements: CodecTypes['pg/jsonb@1']['input'] | null; + readonly socialMetricsLastSyncedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly archivedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly BountyGroup: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly bountyId: CodecTypes['pg/text@1']['input']; + readonly groupId: CodecTypes['pg/text@1']['input']; + }; + readonly BountySubmission: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly bountyId: CodecTypes['pg/text@1']['input']; + readonly performanceCount: CodecTypes['pg/int8@1']['input'] | null; + readonly socialMetricCount: CodecTypes['pg/int4@1']['input'] | null; + readonly commissionId: CodecTypes['pg/text@1']['input'] | null; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly rejectionReason: CodecTypes['pg/enum@1']['input'] | null; + readonly rejectionNote: CodecTypes['pg/text@1']['input'] | null; + readonly files: CodecTypes['pg/jsonb@1']['input'] | null; + readonly urls: CodecTypes['pg/jsonb@1']['input'] | null; + readonly periodNumber: CodecTypes['pg/int4@1']['input']; + readonly socialMetricsLastSyncedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly completedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly reviewedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Campaign: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly workflowId: CodecTypes['pg/text@1']['input'] | null; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly qstashMessageId: CodecTypes['pg/text@1']['input'] | null; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly subject: CodecTypes['pg/text@1']['input']; + readonly preview: CodecTypes['pg/text@1']['input'] | null; + readonly from: CodecTypes['pg/text@1']['input'] | null; + readonly bodyJson: CodecTypes['pg/json@1']['input']; + readonly scheduledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly CampaignGroup: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly campaignId: CodecTypes['pg/text@1']['input']; + readonly groupId: CodecTypes['pg/text@1']['input']; + }; + readonly Commission: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly rewardId: CodecTypes['pg/text@1']['input'] | null; + readonly linkId: CodecTypes['pg/text@1']['input'] | null; + readonly payoutId: CodecTypes['pg/text@1']['input'] | null; + readonly invoiceId: CodecTypes['pg/text@1']['input'] | null; + readonly customerId: CodecTypes['pg/text@1']['input'] | null; + readonly eventId: CodecTypes['pg/text@1']['input'] | null; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly amount: CodecTypes['pg/int4@1']['input']; + readonly quantity: CodecTypes['pg/int4@1']['input']; + readonly earnings: CodecTypes['pg/int4@1']['input']; + readonly currency: CodecTypes['pg/text@1']['input']; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Customer: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input'] | null; + readonly email: CodecTypes['pg/text@1']['input'] | null; + readonly avatar: CodecTypes['pg/text@1']['input'] | null; + readonly externalId: CodecTypes['pg/text@1']['input'] | null; + readonly stripeCustomerId: CodecTypes['pg/text@1']['input'] | null; + readonly linkId: CodecTypes['pg/text@1']['input'] | null; + readonly clickId: CodecTypes['pg/text@1']['input'] | null; + readonly clickedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly country: CodecTypes['pg/text@1']['input'] | null; + readonly sales: CodecTypes['pg/int4@1']['input']; + readonly saleAmount: CodecTypes['pg/int8@1']['input']; + readonly firstSaleAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly subscriptionCanceledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly projectConnectId: CodecTypes['pg/text@1']['input'] | null; + readonly programId: CodecTypes['pg/text@1']['input'] | null; + readonly partnerId: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Dashboard: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly linkId: CodecTypes['pg/text@1']['input'] | null; + readonly folderId: CodecTypes['pg/text@1']['input'] | null; + readonly projectId: CodecTypes['pg/text@1']['input'] | null; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly doIndex: CodecTypes['pg/bool@1']['input']; + readonly password: CodecTypes['pg/text@1']['input'] | null; + readonly showConversions: CodecTypes['pg/bool@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly DefaultDomains: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly dubsh: CodecTypes['pg/bool@1']['input']; + readonly chatgpt: CodecTypes['pg/bool@1']['input']; + readonly sptifi: CodecTypes['pg/bool@1']['input']; + readonly gitnew: CodecTypes['pg/bool@1']['input']; + readonly callink: CodecTypes['pg/bool@1']['input']; + readonly amznid: CodecTypes['pg/bool@1']['input']; + readonly ggllink: CodecTypes['pg/bool@1']['input']; + readonly figpage: CodecTypes['pg/bool@1']['input']; + readonly loooooooong: CodecTypes['pg/bool@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + }; + readonly Discount: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly amount: CodecTypes['pg/int4@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly maxDuration: CodecTypes['pg/int4@1']['input'] | null; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly couponId: CodecTypes['pg/text@1']['input'] | null; + readonly couponTestId: CodecTypes['pg/text@1']['input'] | null; + readonly autoProvisionEnabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly provider: CodecTypes['pg/enum@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly DiscountCode: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly code: CodecTypes['pg/text@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly discountId: CodecTypes['pg/text@1']['input'] | null; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly linkId: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly DiscoveredPartner: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly starredAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly ignoredAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly invitedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly messagedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Domain: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly verified: CodecTypes['pg/bool@1']['input']; + readonly placeholder: CodecTypes['pg/text@1']['input'] | null; + readonly expiredUrl: CodecTypes['pg/text@1']['input'] | null; + readonly notFoundUrl: CodecTypes['pg/text@1']['input'] | null; + readonly primary: CodecTypes['pg/bool@1']['input']; + readonly archived: CodecTypes['pg/bool@1']['input']; + readonly lastChecked: CodecTypes['pg/timestamp@1']['input']; + readonly logo: CodecTypes['pg/text@1']['input'] | null; + readonly appleAppSiteAssociation: CodecTypes['pg/jsonb@1']['input'] | null; + readonly assetLinks: CodecTypes['pg/jsonb@1']['input'] | null; + readonly deepviewData: CodecTypes['pg/jsonb@1']['input'] | null; + readonly linkRetentionDays: CodecTypes['pg/int4@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input'] | null; + }; + readonly EmailDomain: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly workspaceId: CodecTypes['pg/text@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly resendDomainId: CodecTypes['pg/text@1']['input'] | null; + readonly lastChecked: CodecTypes['pg/timestamp@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly EmailVerificationToken: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly identifier: CodecTypes['pg/text@1']['input']; + readonly token: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input']; + }; + readonly Folder: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly accessLevel: CodecTypes['pg/enum@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly FolderAccessRequest: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly folderId: CodecTypes['pg/text@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly FolderUser: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly folderId: CodecTypes['pg/text@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly role: CodecTypes['pg/enum@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly FraudAlert: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly reason: CodecTypes['pg/text@1']['input']; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly reviewedById: CodecTypes['pg/text@1']['input'] | null; + readonly reviewedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly reviewNote: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly FraudEvent: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly fraudEventGroupId: CodecTypes['pg/text@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly linkId: CodecTypes['pg/text@1']['input'] | null; + readonly customerId: CodecTypes['pg/text@1']['input'] | null; + readonly eventId: CodecTypes['pg/text@1']['input'] | null; + readonly sourceProgramId: CodecTypes['pg/text@1']['input'] | null; + readonly hash: CodecTypes['pg/text@1']['input']; + readonly metadata: CodecTypes['pg/json@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly FraudEventGroup: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly lastEventAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly eventCount: CodecTypes['pg/int4@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly resolutionReason: CodecTypes['pg/text@1']['input'] | null; + readonly resolvedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly FraudRule: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly config: CodecTypes['pg/json@1']['input'] | null; + readonly disabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly InstalledIntegration: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly integrationId: CodecTypes['pg/text@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly credentials: CodecTypes['pg/jsonb@1']['input'] | null; + readonly settings: CodecTypes['pg/jsonb@1']['input'] | null; + }; + readonly Integration: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly readme: CodecTypes['pg/text@1']['input'] | null; + readonly developer: CodecTypes['pg/text@1']['input']; + readonly website: CodecTypes['pg/text@1']['input']; + readonly logo: CodecTypes['pg/text@1']['input'] | null; + readonly screenshots: CodecTypes['pg/jsonb@1']['input'] | null; + readonly verified: CodecTypes['pg/bool@1']['input']; + readonly installUrl: CodecTypes['pg/text@1']['input'] | null; + readonly guideUrl: CodecTypes['pg/text@1']['input'] | null; + readonly category: CodecTypes['pg/text@1']['input'] | null; + readonly comingSoon: CodecTypes['pg/bool@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Invoice: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input'] | null; + readonly workspaceId: CodecTypes['pg/text@1']['input']; + readonly number: CodecTypes['pg/text@1']['input'] | null; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly payoutMode: CodecTypes['pg/enum@1']['input']; + readonly paymentMethod: CodecTypes['pg/enum@1']['input'] | null; + readonly amount: CodecTypes['pg/int4@1']['input']; + readonly fee: CodecTypes['pg/int4@1']['input']; + readonly total: CodecTypes['pg/int4@1']['input']; + readonly externalAmount: CodecTypes['pg/int4@1']['input']; + readonly receiptUrl: CodecTypes['pg/text@1']['input'] | null; + readonly failedReason: CodecTypes['pg/text@1']['input'] | null; + readonly registeredDomains: CodecTypes['pg/json@1']['input'] | null; + readonly stripeChargeMetadata: CodecTypes['pg/json@1']['input'] | null; + readonly failedAttempts: CodecTypes['pg/int4@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly paidAt: CodecTypes['pg/timestamp@1']['input'] | null; + }; + readonly jackson_index: { + readonly id: CodecTypes['pg/int4@1']['input']; + readonly key: CodecTypes['sql/varchar@1']['input']; + readonly storeKey: CodecTypes['sql/varchar@1']['input']; + }; + readonly jackson_store: { + readonly key: CodecTypes['sql/varchar@1']['input']; + readonly value: CodecTypes['pg/text@1']['input']; + readonly iv: CodecTypes['sql/varchar@1']['input'] | null; + readonly tag: CodecTypes['sql/varchar@1']['input'] | null; + readonly namespace: CodecTypes['sql/varchar@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly modifiedAt: CodecTypes['pg/timestamp@1']['input'] | null; + }; + readonly jackson_ttl: { + readonly key: CodecTypes['sql/varchar@1']['input']; + readonly expiresAt: CodecTypes['pg/int8@1']['input']; + }; + readonly Link: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly domain: CodecTypes['pg/text@1']['input']; + readonly key: CodecTypes['pg/text@1']['input']; + readonly url: CodecTypes['pg/text@1']['input']; + readonly shortLink: CodecTypes['sql/varchar@1']['input']; + readonly archived: CodecTypes['pg/bool@1']['input']; + readonly expiresAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly expiredUrl: CodecTypes['pg/text@1']['input'] | null; + readonly disabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly password: CodecTypes['pg/text@1']['input'] | null; + readonly trackConversion: CodecTypes['pg/bool@1']['input']; + readonly proxy: CodecTypes['pg/bool@1']['input']; + readonly title: CodecTypes['pg/text@1']['input'] | null; + readonly description: CodecTypes['sql/varchar@1']['input'] | null; + readonly image: CodecTypes['pg/text@1']['input'] | null; + readonly video: CodecTypes['pg/text@1']['input'] | null; + readonly utm_source: CodecTypes['pg/text@1']['input'] | null; + readonly utm_medium: CodecTypes['pg/text@1']['input'] | null; + readonly utm_campaign: CodecTypes['pg/text@1']['input'] | null; + readonly utm_term: CodecTypes['pg/text@1']['input'] | null; + readonly utm_content: CodecTypes['pg/text@1']['input'] | null; + readonly rewrite: CodecTypes['pg/bool@1']['input']; + readonly linkRetentionCleanupDisabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly doIndex: CodecTypes['pg/bool@1']['input']; + readonly ios: CodecTypes['pg/text@1']['input'] | null; + readonly android: CodecTypes['pg/text@1']['input'] | null; + readonly geo: CodecTypes['pg/json@1']['input'] | null; + readonly testVariants: CodecTypes['pg/json@1']['input'] | null; + readonly testStartedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly testCompletedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly projectId: CodecTypes['pg/text@1']['input'] | null; + readonly folderId: CodecTypes['pg/text@1']['input'] | null; + readonly externalId: CodecTypes['pg/text@1']['input'] | null; + readonly tenantId: CodecTypes['pg/text@1']['input'] | null; + readonly publicStats: CodecTypes['pg/bool@1']['input']; + readonly clicks: CodecTypes['pg/int4@1']['input']; + readonly leads: CodecTypes['pg/int4@1']['input']; + readonly conversions: CodecTypes['pg/int4@1']['input']; + readonly sales: CodecTypes['pg/int4@1']['input']; + readonly saleAmount: CodecTypes['pg/int8@1']['input']; + readonly lastClicked: CodecTypes['pg/timestamp@1']['input'] | null; + readonly lastLeadAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly lastConversionAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly comments: CodecTypes['pg/text@1']['input'] | null; + readonly programId: CodecTypes['pg/text@1']['input'] | null; + readonly partnerId: CodecTypes['pg/text@1']['input'] | null; + readonly partnerGroupDefaultLinkId: CodecTypes['pg/text@1']['input'] | null; + }; + readonly LinkTag: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly linkId: CodecTypes['pg/text@1']['input']; + readonly tagId: CodecTypes['pg/text@1']['input']; + }; + readonly LinkWebhook: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly linkId: CodecTypes['pg/text@1']['input']; + readonly webhookId: CodecTypes['pg/text@1']['input']; + }; + readonly Message: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly senderUserId: CodecTypes['pg/text@1']['input']; + readonly senderPartnerId: CodecTypes['pg/text@1']['input'] | null; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly subject: CodecTypes['pg/text@1']['input'] | null; + readonly text: CodecTypes['pg/text@1']['input']; + readonly readInApp: CodecTypes['pg/timestamp@1']['input'] | null; + readonly readInEmail: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly NotificationEmail: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly emailId: CodecTypes['pg/text@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly messageId: CodecTypes['pg/text@1']['input'] | null; + readonly bountyId: CodecTypes['pg/text@1']['input'] | null; + readonly campaignId: CodecTypes['pg/text@1']['input'] | null; + readonly programId: CodecTypes['pg/text@1']['input'] | null; + readonly partnerId: CodecTypes['pg/text@1']['input'] | null; + readonly recipientUserId: CodecTypes['pg/text@1']['input'] | null; + readonly deliveredAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly openedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly bouncedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly NotificationPreference: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly projectUserId: CodecTypes['pg/text@1']['input']; + readonly linkUsageSummary: CodecTypes['pg/bool@1']['input']; + readonly domainConfigurationUpdates: CodecTypes['pg/bool@1']['input']; + readonly newPartnerSale: CodecTypes['pg/bool@1']['input']; + readonly newPartnerApplication: CodecTypes['pg/bool@1']['input']; + readonly pendingApplicationsSummary: CodecTypes['pg/bool@1']['input']; + readonly newBountySubmitted: CodecTypes['pg/bool@1']['input']; + readonly newMessageFromPartner: CodecTypes['pg/bool@1']['input']; + readonly fraudEventsSummary: CodecTypes['pg/bool@1']['input']; + }; + readonly OAuthApp: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly integrationId: CodecTypes['pg/text@1']['input']; + readonly clientId: CodecTypes['pg/text@1']['input']; + readonly hashedClientSecret: CodecTypes['pg/text@1']['input']; + readonly partialClientSecret: CodecTypes['pg/text@1']['input']; + readonly redirectUris: CodecTypes['pg/jsonb@1']['input']; + readonly pkce: CodecTypes['pg/bool@1']['input']; + }; + readonly OAuthCode: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly clientId: CodecTypes['pg/text@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly code: CodecTypes['pg/text@1']['input']; + readonly scopes: CodecTypes['pg/text@1']['input'] | null; + readonly redirectUri: CodecTypes['pg/text@1']['input']; + readonly codeChallenge: CodecTypes['pg/text@1']['input'] | null; + readonly codeChallengeMethod: CodecTypes['pg/text@1']['input'] | null; + readonly expiresAt: CodecTypes['pg/timestamp@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly OAuthRefreshToken: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly installationId: CodecTypes['pg/text@1']['input']; + readonly accessTokenId: CodecTypes['pg/text@1']['input']; + readonly hashedRefreshToken: CodecTypes['pg/text@1']['input']; + readonly expiresAt: CodecTypes['pg/timestamp@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly Partner: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly username: CodecTypes['pg/text@1']['input'] | null; + readonly companyName: CodecTypes['pg/text@1']['input'] | null; + readonly profileType: CodecTypes['pg/enum@1']['input']; + readonly email: CodecTypes['pg/text@1']['input'] | null; + readonly image: CodecTypes['pg/text@1']['input'] | null; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly country: CodecTypes['pg/text@1']['input'] | null; + readonly identityVerificationStatus: CodecTypes['pg/enum@1']['input'] | null; + readonly identityVerifiedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly veriffSessionId: CodecTypes['pg/text@1']['input'] | null; + readonly veriffMetadata: CodecTypes['pg/jsonb@1']['input'] | null; + readonly defaultPayoutMethod: CodecTypes['pg/enum@1']['input'] | null; + readonly payoutsEnabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly connectPayoutsLastRemindedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly paypalEmail: CodecTypes['pg/text@1']['input'] | null; + readonly stripeConnectId: CodecTypes['pg/text@1']['input'] | null; + readonly stripeRecipientId: CodecTypes['pg/text@1']['input'] | null; + readonly payoutMethodHash: CodecTypes['pg/text@1']['input'] | null; + readonly cryptoWalletAddress: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly discoverableAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly trustedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly invoiceSettings: CodecTypes['pg/jsonb@1']['input'] | null; + readonly changeHistoryLog: CodecTypes['pg/jsonb@1']['input'] | null; + readonly referredByPartnerId: CodecTypes['pg/text@1']['input'] | null; + readonly monthlyTraffic: CodecTypes['pg/enum@1']['input'] | null; + }; + readonly PartnerComment: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly text: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly PartnerGroup: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly color: CodecTypes['pg/text@1']['input'] | null; + readonly clickRewardId: CodecTypes['pg/text@1']['input'] | null; + readonly leadRewardId: CodecTypes['pg/text@1']['input'] | null; + readonly saleRewardId: CodecTypes['pg/text@1']['input'] | null; + readonly discountId: CodecTypes['pg/text@1']['input'] | null; + readonly linkStructure: CodecTypes['pg/enum@1']['input']; + readonly additionalLinks: CodecTypes['pg/json@1']['input'] | null; + readonly maxPartnerLinks: CodecTypes['pg/int4@1']['input']; + readonly applicationFormData: CodecTypes['pg/json@1']['input'] | null; + readonly applicationFormPublishedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly landerData: CodecTypes['pg/json@1']['input'] | null; + readonly landerPublishedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly logo: CodecTypes['pg/text@1']['input'] | null; + readonly wordmark: CodecTypes['pg/text@1']['input'] | null; + readonly brandColor: CodecTypes['pg/text@1']['input'] | null; + readonly holdingPeriodDays: CodecTypes['pg/int4@1']['input']; + readonly autoApprovePartnersEnabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly workflowId: CodecTypes['pg/text@1']['input'] | null; + readonly utmTemplateId: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly PartnerGroupDefaultLink: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly groupId: CodecTypes['pg/text@1']['input']; + readonly domain: CodecTypes['pg/text@1']['input']; + readonly url: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly PartnerIndustryInterest: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly industryInterest: CodecTypes['pg/enum@1']['input']; + }; + readonly PartnerInvite: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly email: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly role: CodecTypes['pg/enum@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly PartnerNotificationPreferences: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerUserId: CodecTypes['pg/text@1']['input']; + readonly commissionCreated: CodecTypes['pg/bool@1']['input']; + readonly applicationApproved: CodecTypes['pg/bool@1']['input']; + readonly newMessageFromProgram: CodecTypes['pg/bool@1']['input']; + readonly marketingCampaign: CodecTypes['pg/bool@1']['input']; + readonly connectPayoutReminder: CodecTypes['pg/bool@1']['input']; + readonly monthlyProgramSummary: CodecTypes['pg/bool@1']['input']; + }; + readonly PartnerPlatform: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly identifier: CodecTypes['pg/text@1']['input']; + readonly platformId: CodecTypes['pg/text@1']['input'] | null; + readonly avatarUrl: CodecTypes['pg/text@1']['input'] | null; + readonly subscribers: CodecTypes['pg/int8@1']['input']; + readonly posts: CodecTypes['pg/int8@1']['input']; + readonly views: CodecTypes['pg/int8@1']['input']; + readonly metadata: CodecTypes['pg/jsonb@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly verifiedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly lastCheckedAt: CodecTypes['pg/timestamp@1']['input'] | null; + }; + readonly PartnerPreferredEarningStructure: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly preferredEarningStructure: CodecTypes['pg/enum@1']['input']; + }; + readonly PartnerReferral: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly customerId: CodecTypes['pg/text@1']['input'] | null; + readonly name: CodecTypes['pg/text@1']['input']; + readonly email: CodecTypes['pg/text@1']['input']; + readonly company: CodecTypes['pg/text@1']['input']; + readonly formData: CodecTypes['pg/json@1']['input'] | null; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly PartnerRewind: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly year: CodecTypes['pg/int4@1']['input']; + readonly totalClicks: CodecTypes['pg/int4@1']['input']; + readonly totalLeads: CodecTypes['pg/int4@1']['input']; + readonly totalRevenue: CodecTypes['pg/int4@1']['input']; + readonly totalEarnings: CodecTypes['pg/int4@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly sentAt: CodecTypes['pg/timestamp@1']['input'] | null; + }; + readonly PartnerSalesChannel: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly salesChannel: CodecTypes['pg/enum@1']['input']; + }; + readonly PartnerUser: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly role: CodecTypes['pg/enum@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly PasswordResetToken: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly identifier: CodecTypes['pg/text@1']['input']; + readonly token: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input']; + }; + readonly Payout: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly invoiceId: CodecTypes['pg/text@1']['input'] | null; + readonly amount: CodecTypes['pg/int4@1']['input']; + readonly currency: CodecTypes['pg/text@1']['input']; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly mode: CodecTypes['pg/enum@1']['input'] | null; + readonly method: CodecTypes['pg/enum@1']['input'] | null; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly periodStart: CodecTypes['pg/timestamp@1']['input'] | null; + readonly periodEnd: CodecTypes['pg/timestamp@1']['input'] | null; + readonly paypalTransferId: CodecTypes['pg/text@1']['input'] | null; + readonly stripeTransferId: CodecTypes['pg/text@1']['input'] | null; + readonly stripePayoutId: CodecTypes['pg/text@1']['input'] | null; + readonly stripePayoutTraceId: CodecTypes['pg/text@1']['input'] | null; + readonly failureReason: CodecTypes['pg/text@1']['input'] | null; + readonly webhookEventId: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly initiatedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly paidAt: CodecTypes['pg/timestamp@1']['input'] | null; + }; + readonly Postback: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly url: CodecTypes['pg/text@1']['input']; + readonly secret: CodecTypes['pg/text@1']['input']; + readonly triggers: CodecTypes['pg/jsonb@1']['input']; + readonly receiver: CodecTypes['pg/enum@1']['input']; + readonly disabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Program: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly workspaceId: CodecTypes['pg/text@1']['input']; + readonly defaultFolderId: CodecTypes['pg/text@1']['input']; + readonly defaultGroupId: CodecTypes['pg/text@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly domain: CodecTypes['pg/text@1']['input'] | null; + readonly url: CodecTypes['pg/text@1']['input'] | null; + readonly logo: CodecTypes['pg/text@1']['input'] | null; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly primaryRewardEvent: CodecTypes['pg/enum@1']['input']; + readonly minPayoutAmount: CodecTypes['pg/int4@1']['input']; + readonly payoutMode: CodecTypes['pg/enum@1']['input']; + readonly inviteEmailData: CodecTypes['pg/json@1']['input'] | null; + readonly embedData: CodecTypes['pg/json@1']['input'] | null; + readonly resources: CodecTypes['pg/json@1']['input'] | null; + readonly referralFormData: CodecTypes['pg/json@1']['input'] | null; + readonly applicationRequirements: CodecTypes['pg/json@1']['input'] | null; + readonly termsUrl: CodecTypes['pg/text@1']['input'] | null; + readonly helpUrl: CodecTypes['pg/text@1']['input'] | null; + readonly supportEmail: CodecTypes['pg/text@1']['input'] | null; + readonly messagingEnabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly partnerNetworkEnabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly startedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly deactivatedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly addedToMarketplaceAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly featuredOnMarketplaceAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly marketplaceHeaderImage: CodecTypes['pg/text@1']['input'] | null; + readonly marketplaceRanking: CodecTypes['pg/int4@1']['input']; + }; + readonly ProgramApplication: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly groupId: CodecTypes['pg/text@1']['input'] | null; + readonly name: CodecTypes['pg/text@1']['input']; + readonly email: CodecTypes['pg/text@1']['input']; + readonly country: CodecTypes['pg/text@1']['input'] | null; + readonly website: CodecTypes['pg/text@1']['input'] | null; + readonly youtube: CodecTypes['pg/text@1']['input'] | null; + readonly twitter: CodecTypes['pg/text@1']['input'] | null; + readonly linkedin: CodecTypes['pg/text@1']['input'] | null; + readonly instagram: CodecTypes['pg/text@1']['input'] | null; + readonly tiktok: CodecTypes['pg/text@1']['input'] | null; + readonly formData: CodecTypes['pg/json@1']['input'] | null; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly rejectionReason: CodecTypes['pg/enum@1']['input'] | null; + readonly rejectionNote: CodecTypes['pg/text@1']['input'] | null; + readonly reviewedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly ProgramApplicationEvent: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly visitedAt: CodecTypes['pg/timestamp@1']['input']; + readonly startedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly submittedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly approvedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly rejectedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly country: CodecTypes['pg/text@1']['input'] | null; + readonly referralSource: CodecTypes['pg/text@1']['input']; + readonly referredByPartnerId: CodecTypes['pg/text@1']['input'] | null; + readonly metadata: CodecTypes['pg/json@1']['input'] | null; + readonly programApplicationId: CodecTypes['pg/text@1']['input'] | null; + readonly partnerId: CodecTypes['pg/text@1']['input'] | null; + }; + readonly ProgramCategory: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly category: CodecTypes['pg/enum@1']['input']; + }; + readonly ProgramEnrollment: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly partnerId: CodecTypes['pg/text@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly tenantId: CodecTypes['pg/text@1']['input'] | null; + readonly groupId: CodecTypes['pg/text@1']['input'] | null; + readonly applicationId: CodecTypes['pg/text@1']['input'] | null; + readonly clickRewardId: CodecTypes['pg/text@1']['input'] | null; + readonly leadRewardId: CodecTypes['pg/text@1']['input'] | null; + readonly saleRewardId: CodecTypes['pg/text@1']['input'] | null; + readonly discountId: CodecTypes['pg/text@1']['input'] | null; + readonly status: CodecTypes['pg/enum@1']['input']; + readonly totalClicks: CodecTypes['pg/int4@1']['input']; + readonly totalLeads: CodecTypes['pg/int4@1']['input']; + readonly totalConversions: CodecTypes['pg/int4@1']['input']; + readonly totalSales: CodecTypes['pg/int4@1']['input']; + readonly totalSaleAmount: CodecTypes['pg/int8@1']['input']; + readonly totalCommissions: CodecTypes['pg/int8@1']['input']; + readonly netRevenue: CodecTypes['pg/int8@1']['input']; + readonly earningsPerClick: CodecTypes['pg/float8@1']['input']; + readonly averageLifetimeValue: CodecTypes['pg/float8@1']['input'] | null; + readonly clickToLeadRate: CodecTypes['pg/float8@1']['input'] | null; + readonly clickToConversionRate: CodecTypes['pg/float8@1']['input'] | null; + readonly leadToConversionRate: CodecTypes['pg/float8@1']['input'] | null; + readonly returnOnAdSpend: CodecTypes['pg/float8@1']['input'] | null; + readonly lastConversionAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly daysSinceLastConversion: CodecTypes['pg/int4@1']['input'] | null; + readonly consistencyScore: CodecTypes['pg/int4@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly customerDataSharingEnabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly groupMoveDisabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly bannedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly bannedReason: CodecTypes['pg/enum@1']['input'] | null; + }; + readonly ProgramSimilarity: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly similarProgramId: CodecTypes['pg/text@1']['input']; + readonly similarityScore: CodecTypes['pg/float8@1']['input']; + readonly categorySimilarityScore: CodecTypes['pg/float8@1']['input']; + readonly partnerSimilarityScore: CodecTypes['pg/float8@1']['input']; + readonly performanceSimilarityScore: CodecTypes['pg/float8@1']['input']; + }; + readonly Project: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly logo: CodecTypes['pg/text@1']['input'] | null; + readonly inviteCode: CodecTypes['pg/text@1']['input'] | null; + readonly defaultProgramId: CodecTypes['pg/text@1']['input'] | null; + readonly plan: CodecTypes['pg/text@1']['input']; + readonly planTier: CodecTypes['pg/int4@1']['input']; + readonly planPeriod: CodecTypes['pg/enum@1']['input'] | null; + readonly stripeId: CodecTypes['pg/text@1']['input'] | null; + readonly billingCycleStart: CodecTypes['pg/int4@1']['input']; + readonly billingCycleEndsAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly trialEndsAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly subscriptionCanceledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly paymentFailedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly invoicePrefix: CodecTypes['pg/text@1']['input'] | null; + readonly stripeConnectId: CodecTypes['pg/text@1']['input'] | null; + readonly shopifyStoreId: CodecTypes['pg/text@1']['input'] | null; + readonly totalLinks: CodecTypes['pg/int4@1']['input']; + readonly totalClicks: CodecTypes['pg/int4@1']['input']; + readonly usage: CodecTypes['pg/int4@1']['input']; + readonly usageLimit: CodecTypes['pg/int4@1']['input']; + readonly linksUsage: CodecTypes['pg/int4@1']['input']; + readonly linksLimit: CodecTypes['pg/int4@1']['input']; + readonly payoutsUsage: CodecTypes['pg/int4@1']['input']; + readonly payoutsLimit: CodecTypes['pg/int4@1']['input']; + readonly payoutFee: CodecTypes['pg/float8@1']['input']; + readonly payoutFeeWaiverLimit: CodecTypes['pg/int4@1']['input']; + readonly payoutFeeWaiverUsage: CodecTypes['pg/int4@1']['input']; + readonly domainsLimit: CodecTypes['pg/int4@1']['input']; + readonly tagsLimit: CodecTypes['pg/int4@1']['input']; + readonly foldersUsage: CodecTypes['pg/int4@1']['input']; + readonly foldersLimit: CodecTypes['pg/int4@1']['input']; + readonly partnersUsage: CodecTypes['pg/int4@1']['input']; + readonly partnersLimit: CodecTypes['pg/int4@1']['input']; + readonly groupsLimit: CodecTypes['pg/int4@1']['input']; + readonly usersLimit: CodecTypes['pg/int4@1']['input']; + readonly aiUsage: CodecTypes['pg/int4@1']['input']; + readonly aiLimit: CodecTypes['pg/int4@1']['input']; + readonly networkInvitesLimit: CodecTypes['pg/int4@1']['input']; + readonly referralLinkId: CodecTypes['pg/text@1']['input'] | null; + readonly referredSignups: CodecTypes['pg/int4@1']['input']; + readonly store: CodecTypes['pg/jsonb@1']['input'] | null; + readonly siteVisitTrackingSettings: CodecTypes['pg/jsonb@1']['input'] | null; + readonly allowedHostnames: CodecTypes['pg/jsonb@1']['input'] | null; + readonly publishableKey: CodecTypes['pg/text@1']['input'] | null; + readonly conversionEnabled: CodecTypes['pg/bool@1']['input']; + readonly webhookEnabled: CodecTypes['pg/bool@1']['input']; + readonly dotLinkClaimed: CodecTypes['pg/bool@1']['input']; + readonly fastDirectDebitPayouts: CodecTypes['pg/bool@1']['input']; + readonly ssoEmailDomain: CodecTypes['pg/text@1']['input'] | null; + readonly ssoEnforcedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly usageLastChecked: CodecTypes['pg/timestamp@1']['input']; + }; + readonly ProjectInvite: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly email: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly role: CodecTypes['pg/enum@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + }; + readonly ProjectUsers: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly role: CodecTypes['pg/enum@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly workspacePreferences: CodecTypes['pg/jsonb@1']['input'] | null; + readonly defaultFolderId: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly RegisteredDomain: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly slug: CodecTypes['pg/text@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly domainId: CodecTypes['pg/text@1']['input'] | null; + readonly autoRenewalDisabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly renewalFee: CodecTypes['pg/int4@1']['input']; + readonly expiresAt: CodecTypes['pg/timestamp@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly RestrictedToken: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly hashedKey: CodecTypes['pg/text@1']['input']; + readonly partialKey: CodecTypes['pg/text@1']['input']; + readonly scopes: CodecTypes['pg/text@1']['input'] | null; + readonly expires: CodecTypes['pg/timestamp@1']['input'] | null; + readonly lastUsed: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly installationId: CodecTypes['pg/text@1']['input'] | null; + }; + readonly Reward: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly description: CodecTypes['pg/text@1']['input'] | null; + readonly tooltipDescription: CodecTypes['pg/text@1']['input'] | null; + readonly event: CodecTypes['pg/enum@1']['input']; + readonly type: CodecTypes['pg/enum@1']['input']; + readonly amountInCents: CodecTypes['pg/int4@1']['input'] | null; + readonly amountInPercentage: CodecTypes['pg/numeric@1']['input'] | null; + readonly maxDuration: CodecTypes['pg/int4@1']['input'] | null; + readonly modifiers: CodecTypes['pg/json@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly SentEmail: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly type: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input'] | null; + }; + readonly Session: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly sessionToken: CodecTypes['pg/text@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input']; + }; + readonly Tag: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly color: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + }; + readonly Token: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly hashedKey: CodecTypes['pg/text@1']['input']; + readonly partialKey: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input'] | null; + readonly lastUsed: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + }; + readonly User: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input'] | null; + readonly email: CodecTypes['pg/text@1']['input'] | null; + readonly emailVerified: CodecTypes['pg/timestamp@1']['input'] | null; + readonly image: CodecTypes['pg/text@1']['input'] | null; + readonly isMachine: CodecTypes['pg/bool@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly passwordHash: CodecTypes['pg/text@1']['input'] | null; + readonly invalidLoginAttempts: CodecTypes['pg/int4@1']['input']; + readonly lockedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly defaultWorkspace: CodecTypes['pg/text@1']['input'] | null; + readonly defaultPartnerId: CodecTypes['pg/text@1']['input'] | null; + readonly source: CodecTypes['pg/text@1']['input'] | null; + readonly sentMail: CodecTypes['pg/bool@1']['input']; + }; + readonly UserNotificationPreferences: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly userId: CodecTypes['pg/text@1']['input']; + readonly dubLinks: CodecTypes['pg/bool@1']['input']; + readonly dubPartners: CodecTypes['pg/bool@1']['input']; + readonly partnerAccount: CodecTypes['pg/bool@1']['input']; + }; + readonly UtmTemplate: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly utm_source: CodecTypes['pg/text@1']['input'] | null; + readonly utm_medium: CodecTypes['pg/text@1']['input'] | null; + readonly utm_campaign: CodecTypes['pg/text@1']['input'] | null; + readonly utm_term: CodecTypes['pg/text@1']['input'] | null; + readonly utm_content: CodecTypes['pg/text@1']['input'] | null; + readonly ref: CodecTypes['pg/text@1']['input'] | null; + readonly userId: CodecTypes['pg/text@1']['input'] | null; + readonly projectId: CodecTypes['pg/text@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly VerificationToken: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly identifier: CodecTypes['pg/text@1']['input']; + readonly token: CodecTypes['pg/text@1']['input']; + readonly expires: CodecTypes['pg/timestamp@1']['input']; + }; + readonly Webhook: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly projectId: CodecTypes['pg/text@1']['input']; + readonly installationId: CodecTypes['pg/text@1']['input'] | null; + readonly receiver: CodecTypes['pg/enum@1']['input']; + readonly name: CodecTypes['pg/text@1']['input']; + readonly url: CodecTypes['pg/text@1']['input']; + readonly secret: CodecTypes['pg/text@1']['input']; + readonly triggers: CodecTypes['pg/jsonb@1']['input']; + readonly consecutiveFailures: CodecTypes['pg/int4@1']['input']; + readonly lastFailedAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly disabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly Workflow: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly programId: CodecTypes['pg/text@1']['input']; + readonly name: CodecTypes['pg/text@1']['input'] | null; + readonly trigger: CodecTypes['pg/enum@1']['input']; + readonly triggerConditions: CodecTypes['pg/jsonb@1']['input']; + readonly actions: CodecTypes['pg/jsonb@1']['input']; + readonly disabledAt: CodecTypes['pg/timestamp@1']['input'] | null; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly updatedAt: CodecTypes['pg/timestamptz@1']['input']; + }; + readonly YearInReview: { + readonly id: CodecTypes['sql/char@1']['input']; + readonly year: CodecTypes['pg/int4@1']['input']; + readonly totalLinks: CodecTypes['pg/int4@1']['input']; + readonly totalClicks: CodecTypes['pg/int4@1']['input']; + readonly topLinks: CodecTypes['pg/jsonb@1']['input']; + readonly topCountries: CodecTypes['pg/jsonb@1']['input']; + readonly workspaceId: CodecTypes['pg/text@1']['input']; + readonly createdAt: CodecTypes['pg/timestamp@1']['input']; + readonly sentAt: CodecTypes['pg/timestamp@1']['input'] | null; + }; +}; +export type TypeMaps = TypeMapsType< + CodecTypes, + QueryOperationTypes, + FieldOutputTypes, + FieldInputTypes +>; + +type ContractBase = ContractType< + { + readonly tables: { + readonly Account: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly type: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly provider: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly providerAccountId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly refresh_token: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly refresh_token_expires_in: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly access_token: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly expires_at: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly token_type: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly scope: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly id_token: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly session_state: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['provider', 'providerAccountId'] }]; + indexes: readonly [{ readonly columns: readonly ['userId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ActivityLog: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly workspaceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly parentResourceType: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly parentResourceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly resourceType: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly resourceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly action: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly batchId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly changeSet: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['resourceType', 'resourceId'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Bounty: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly workflowId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly type: { + readonly nativeType: 'BountyType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'BountyType'; + }; + readonly startsAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + readonly endsAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly submissionsOpenAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly submissionFrequency: { + readonly nativeType: 'BountySubmissionFrequency'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'BountySubmissionFrequency'; + }; + readonly maxSubmissions: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 1>; + }; + }; + readonly rewardAmount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly rewardDescription: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly performanceScope: { + readonly nativeType: 'BountyPerformanceScope'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'BountyPerformanceScope'; + }; + readonly submissionRequirements: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly socialMetricsLastSyncedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly archivedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['workflowId'] }]; + indexes: readonly [{ readonly columns: readonly ['programId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['workflowId']; + readonly references: { readonly table: 'Workflow'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly BountyGroup: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly bountyId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly groupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['bountyId', 'groupId'] }]; + indexes: readonly [{ readonly columns: readonly ['groupId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['bountyId']; + readonly references: { readonly table: 'Bounty'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['groupId']; + readonly references: { + readonly table: 'PartnerGroup'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly BountySubmission: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly bountyId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly performanceCount: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: true; + }; + readonly socialMetricCount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly commissionId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly status: { + readonly nativeType: 'BountySubmissionStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'draft'>; + }; + readonly typeRef: 'BountySubmissionStatus'; + }; + readonly rejectionReason: { + readonly nativeType: 'BountySubmissionRejectionReason'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'BountySubmissionRejectionReason'; + }; + readonly rejectionNote: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly files: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly urls: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly periodNumber: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 1>; + }; + }; + readonly socialMetricsLastSyncedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly completedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly reviewedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['commissionId'] }, + { readonly columns: readonly ['bountyId', 'partnerId', 'periodNumber'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['userId'] }, + { readonly columns: readonly ['status'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['bountyId']; + readonly references: { readonly table: 'Bounty'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['commissionId']; + readonly references: { + readonly table: 'Commission'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Campaign: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly workflowId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly qstashMessageId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly type: { + readonly nativeType: 'CampaignType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'CampaignType'; + }; + readonly status: { + readonly nativeType: 'CampaignStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'draft'>; + }; + readonly typeRef: 'CampaignStatus'; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly subject: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly preview: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly from: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly bodyJson: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: false; + }; + readonly scheduledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['workflowId'] }, + { readonly columns: readonly ['qstashMessageId'] }, + ]; + indexes: readonly [{ readonly columns: readonly ['programId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['workflowId']; + readonly references: { readonly table: 'Workflow'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly CampaignGroup: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly campaignId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly groupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['campaignId', 'groupId'] }]; + indexes: readonly [{ readonly columns: readonly ['groupId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['campaignId']; + readonly references: { readonly table: 'Campaign'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['groupId']; + readonly references: { + readonly table: 'PartnerGroup'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Commission: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly rewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly payoutId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly invoiceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly customerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly eventId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly type: { + readonly nativeType: 'CommissionType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'CommissionType'; + }; + readonly amount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly quantity: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly earnings: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly currency: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/text@1', 'usd'>; + }; + }; + readonly status: { + readonly nativeType: 'CommissionStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'CommissionStatus'; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['eventId'] }, + { readonly columns: readonly ['invoiceId', 'programId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['earnings', 'programId', 'partnerId', 'status'] }, + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['programId', 'status', 'createdAt', 'amount', 'earnings'] }, + { readonly columns: readonly ['createdAt', 'status', 'programId', 'earnings'] }, + { readonly columns: readonly ['partnerId', 'customerId'] }, + { readonly columns: readonly ['payoutId'] }, + { readonly columns: readonly ['customerId'] }, + { readonly columns: readonly ['linkId'] }, + { readonly columns: readonly ['status'] }, + { readonly columns: readonly ['rewardId'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['payoutId']; + readonly references: { readonly table: 'Payout'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['customerId']; + readonly references: { readonly table: 'Customer'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['rewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Customer: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly avatar: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly externalId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripeCustomerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly clickId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly clickedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly country: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly sales: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly saleAmount: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly firstSaleAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly subscriptionCanceledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly projectConnectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['stripeCustomerId'] }, + { readonly columns: readonly ['projectId', 'externalId'] }, + { readonly columns: readonly ['projectConnectId', 'externalId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['projectId', 'email'] }, + { readonly columns: readonly ['projectId', 'createdAt'] }, + { readonly columns: readonly ['projectId', 'saleAmount'] }, + { readonly columns: readonly ['projectId', 'firstSaleAt'] }, + { readonly columns: readonly ['projectId', 'subscriptionCanceledAt'] }, + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['linkId'] }, + { readonly columns: readonly ['country'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Dashboard: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly folderId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly doIndex: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly password: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly showConversions: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['linkId'] }, + { readonly columns: readonly ['folderId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['folderId']; + readonly references: { readonly table: 'Folder'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly DefaultDomains: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly dubsh: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly chatgpt: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly sptifi: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly gitnew: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly callink: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly amznid: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly ggllink: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly figpage: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly loooooooong: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['projectId'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Discount: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly amount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly type: { + readonly nativeType: 'RewardStructure'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'percentage'>; + }; + readonly typeRef: 'RewardStructure'; + }; + readonly maxDuration: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly couponId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly couponTestId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly autoProvisionEnabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly provider: { + readonly nativeType: 'DiscountProvider'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'stripe'>; + }; + readonly typeRef: 'DiscountProvider'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [{ readonly columns: readonly ['programId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly DiscountCode: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly code: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly discountId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['linkId'] }, + { readonly columns: readonly ['programId', 'code'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['discountId'] }, + { readonly columns: readonly ['partnerId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['discountId']; + readonly references: { readonly table: 'Discount'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly DiscoveredPartner: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly starredAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly ignoredAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly invitedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly messagedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['programId', 'partnerId'] }]; + indexes: readonly [{ readonly columns: readonly ['partnerId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Domain: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly verified: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly placeholder: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly expiredUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly notFoundUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly primary: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly archived: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly lastChecked: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly logo: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly appleAppSiteAssociation: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly assetLinks: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly deepviewData: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/jsonb@1', '{}'>; + }; + }; + readonly linkRetentionDays: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['slug'] }]; + indexes: readonly [ + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['lastChecked'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly EmailDomain: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly workspaceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly status: { + readonly nativeType: 'EmailDomainStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'EmailDomainStatus'; + }; + readonly resendDomainId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly lastChecked: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['slug'] }, + { readonly columns: readonly ['resendDomainId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['lastChecked'] }, + { readonly columns: readonly ['programId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly EmailVerificationToken: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly identifier: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly token: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['token'] }, + { readonly columns: readonly ['identifier', 'token'] }, + ]; + indexes: readonly []; + foreignKeys: readonly []; + }; + readonly Folder: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly type: { + readonly nativeType: 'FolderType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'default'>; + }; + readonly typeRef: 'FolderType'; + }; + readonly accessLevel: { + readonly nativeType: 'FolderAccessLevel'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'FolderAccessLevel'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['name', 'projectId'] }]; + indexes: readonly [{ readonly columns: readonly ['projectId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly FolderAccessRequest: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly folderId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['folderId', 'userId'] }]; + indexes: readonly [{ readonly columns: readonly ['userId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['folderId']; + readonly references: { readonly table: 'Folder'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly FolderUser: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly folderId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly role: { + readonly nativeType: 'FolderUserRole'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'FolderUserRole'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['folderId', 'userId'] }]; + indexes: readonly [{ readonly columns: readonly ['userId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['folderId']; + readonly references: { readonly table: 'Folder'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly FraudAlert: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly reason: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly status: { + readonly nativeType: 'FraudAlertStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'FraudAlertStatus'; + }; + readonly reviewedById: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly reviewedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly reviewNote: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['status'] }, + { readonly columns: readonly ['createdAt'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['reviewedById']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly FraudEvent: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly fraudEventGroupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly customerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly eventId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly sourceProgramId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly hash: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly metadata: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId', 'customerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['customerId'] }, + { readonly columns: readonly ['linkId'] }, + { readonly columns: readonly ['eventId'] }, + { readonly columns: readonly ['hash'] }, + { readonly columns: readonly ['sourceProgramId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['fraudEventGroupId']; + readonly references: { + readonly table: 'FraudEventGroup'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['customerId']; + readonly references: { readonly table: 'Customer'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['sourceProgramId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly FraudEventGroup: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly type: { + readonly nativeType: 'FraudRuleType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'FraudRuleType'; + }; + readonly lastEventAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly eventCount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly resolutionReason: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly resolvedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly status: { + readonly nativeType: 'FraudEventStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'FraudEventStatus'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId', 'type', 'status'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly FraudRule: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly type: { + readonly nativeType: 'FraudRuleType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'FraudRuleType'; + }; + readonly config: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly disabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['programId', 'type'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly InstalledIntegration: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly integrationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly credentials: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly settings: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['userId', 'integrationId', 'projectId'] }]; + indexes: readonly [ + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['integrationId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['integrationId']; + readonly references: { + readonly table: 'Integration'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Integration: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly readme: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly developer: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly website: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly logo: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly screenshots: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly verified: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly installUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly guideUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly category: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly comingSoon: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['slug'] }]; + indexes: readonly [ + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Invoice: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly workspaceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly number: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly status: { + readonly nativeType: 'InvoiceStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'processing'>; + }; + readonly typeRef: 'InvoiceStatus'; + }; + readonly type: { + readonly nativeType: 'InvoiceType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'partnerPayout'>; + }; + readonly typeRef: 'InvoiceType'; + }; + readonly payoutMode: { + readonly nativeType: 'ProgramPayoutMode'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'internal'>; + }; + readonly typeRef: 'ProgramPayoutMode'; + }; + readonly paymentMethod: { + readonly nativeType: 'PaymentMethod'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'PaymentMethod'; + }; + readonly amount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly fee: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly total: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly externalAmount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly receiptUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly failedReason: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly registeredDomains: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly stripeChargeMetadata: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly failedAttempts: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly paidAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['number'] }]; + indexes: readonly [ + { readonly columns: readonly ['programId'] }, + { readonly columns: readonly ['workspaceId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['workspaceId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly jackson_index: { + columns: { + readonly id: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'autoincrement()' }; + }; + readonly key: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: false; + readonly typeRef: 'VarChar250'; + }; + readonly storeKey: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: false; + readonly typeRef: 'VarChar250'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { + readonly columns: readonly ['key', 'storeKey']; + readonly name: '_jackson_index_key_store'; + }, + ]; + foreignKeys: readonly []; + }; + readonly jackson_store: { + columns: { + readonly key: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: false; + readonly typeRef: 'VarChar250'; + }; + readonly value: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly iv: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: true; + readonly typeRef: 'VarChar64'; + }; + readonly tag: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: true; + readonly typeRef: 'VarChar64'; + }; + readonly namespace: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: true; + readonly typeRef: 'VarChar64'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp0'; + }; + readonly modifiedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp0'; + }; + }; + primaryKey: { readonly columns: readonly ['key'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['namespace']; readonly name: '_jackson_store_namespace' }, + ]; + foreignKeys: readonly []; + }; + readonly jackson_ttl: { + columns: { + readonly key: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: false; + readonly typeRef: 'VarChar250'; + }; + readonly expiresAt: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['key'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['expiresAt']; readonly name: '_jackson_ttl_expires_at' }, + ]; + foreignKeys: readonly []; + }; + readonly Link: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly domain: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly key: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly url: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly shortLink: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: false; + readonly typeRef: 'VarChar400'; + }; + readonly archived: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly expiresAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly expiredUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly disabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly password: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly trackConversion: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly proxy: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly title: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly description: { + readonly nativeType: 'character varying'; + readonly codecId: 'sql/varchar@1'; + readonly nullable: true; + readonly typeRef: 'VarChar280'; + }; + readonly image: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly video: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_source: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_medium: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_campaign: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_term: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_content: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly rewrite: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly linkRetentionCleanupDisabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly doIndex: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly ios: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly android: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly geo: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly testVariants: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly testStartedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly testCompletedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly folderId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly externalId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly tenantId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly publicStats: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly clicks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly leads: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly conversions: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly sales: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly saleAmount: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly lastClicked: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly lastLeadAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly lastConversionAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly comments: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly partnerGroupDefaultLinkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['shortLink'] }, + { readonly columns: readonly ['domain', 'key'] }, + { readonly columns: readonly ['projectId', 'externalId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['projectId', 'tenantId'] }, + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['projectId', 'folderId', 'archived', 'createdAt'] }, + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['domain', 'createdAt'] }, + { readonly columns: readonly ['folderId'] }, + { readonly columns: readonly ['userId'] }, + { readonly columns: readonly ['partnerGroupDefaultLinkId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['folderId']; + readonly references: { readonly table: 'Folder'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['domain']; + readonly references: { readonly table: 'Domain'; readonly columns: readonly ['slug'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerGroupDefaultLinkId']; + readonly references: { + readonly table: 'PartnerGroupDefaultLink'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly LinkTag: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly tagId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['linkId', 'tagId'] }]; + indexes: readonly [{ readonly columns: readonly ['tagId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['tagId']; + readonly references: { readonly table: 'Tag'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly LinkWebhook: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly linkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly webhookId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['linkId', 'webhookId'] }]; + indexes: readonly [{ readonly columns: readonly ['webhookId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['linkId']; + readonly references: { readonly table: 'Link'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['webhookId']; + readonly references: { readonly table: 'Webhook'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Message: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly senderUserId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly senderPartnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly type: { + readonly nativeType: 'MessageType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'direct'>; + }; + readonly typeRef: 'MessageType'; + }; + readonly subject: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly text: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly readInApp: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly readInEmail: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['senderPartnerId'] }, + { readonly columns: readonly ['senderUserId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['senderUserId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['senderPartnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly NotificationEmail: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly emailId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly type: { + readonly nativeType: 'NotificationEmailType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'NotificationEmailType'; + }; + readonly messageId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly bountyId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly campaignId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly recipientUserId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly deliveredAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly openedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly bouncedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['emailId'] }]; + indexes: readonly [ + { readonly columns: readonly ['type'] }, + { readonly columns: readonly ['messageId'] }, + { readonly columns: readonly ['bountyId'] }, + { readonly columns: readonly ['campaignId'] }, + { readonly columns: readonly ['partnerId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['messageId']; + readonly references: { readonly table: 'Message'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['bountyId']; + readonly references: { readonly table: 'Bounty'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['campaignId']; + readonly references: { readonly table: 'Campaign'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly NotificationPreference: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly projectUserId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly linkUsageSummary: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly domainConfigurationUpdates: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly newPartnerSale: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly newPartnerApplication: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly pendingApplicationsSummary: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly newBountySubmitted: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly newMessageFromPartner: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly fraudEventsSummary: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['projectUserId'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectUserId']; + readonly references: { + readonly table: 'ProjectUsers'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly OAuthApp: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly integrationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly clientId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly hashedClientSecret: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partialClientSecret: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly redirectUris: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly pkce: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['integrationId'] }, + { readonly columns: readonly ['clientId'] }, + ]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['integrationId']; + readonly references: { + readonly table: 'Integration'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly OAuthCode: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly clientId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly code: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly scopes: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly redirectUri: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly codeChallenge: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly codeChallengeMethod: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly expiresAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['code'] }]; + indexes: readonly [ + { readonly columns: readonly ['clientId'] }, + { readonly columns: readonly ['userId'] }, + { readonly columns: readonly ['projectId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['clientId']; + readonly references: { + readonly table: 'OAuthApp'; + readonly columns: readonly ['clientId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly OAuthRefreshToken: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly installationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly accessTokenId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly hashedRefreshToken: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expiresAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['hashedRefreshToken'] }]; + indexes: readonly [ + { readonly columns: readonly ['installationId'] }, + { readonly columns: readonly ['accessTokenId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['accessTokenId']; + readonly references: { + readonly table: 'RestrictedToken'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['installationId']; + readonly references: { + readonly table: 'InstalledIntegration'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Partner: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly username: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly companyName: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly profileType: { + readonly nativeType: 'PartnerProfileType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'individual'>; + }; + readonly typeRef: 'PartnerProfileType'; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly image: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly country: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly identityVerificationStatus: { + readonly nativeType: 'IdentityVerificationStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'IdentityVerificationStatus'; + }; + readonly identityVerifiedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly veriffSessionId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly veriffMetadata: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly defaultPayoutMethod: { + readonly nativeType: 'PartnerPayoutMethod'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'PartnerPayoutMethod'; + }; + readonly payoutsEnabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly connectPayoutsLastRemindedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly paypalEmail: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripeConnectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripeRecipientId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly payoutMethodHash: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly cryptoWalletAddress: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly discoverableAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly trustedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly invoiceSettings: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly changeHistoryLog: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly referredByPartnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly monthlyTraffic: { + readonly nativeType: 'MonthlyTraffic'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'MonthlyTraffic'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['username'] }, + { readonly columns: readonly ['email'] }, + { readonly columns: readonly ['veriffSessionId'] }, + { readonly columns: readonly ['paypalEmail'] }, + { readonly columns: readonly ['stripeConnectId'] }, + { readonly columns: readonly ['stripeRecipientId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['country'] }, + { readonly columns: readonly ['discoverableAt'] }, + { readonly columns: readonly ['trustedAt'] }, + { readonly columns: readonly ['payoutMethodHash'] }, + { readonly columns: readonly ['cryptoWalletAddress'] }, + { readonly columns: readonly ['identityVerifiedAt'] }, + ]; + foreignKeys: readonly []; + }; + readonly PartnerComment: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly text: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['createdAt'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerGroup: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly color: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly clickRewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly leadRewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly saleRewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly discountId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly linkStructure: { + readonly nativeType: 'PartnerLinkStructure'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'short'>; + }; + readonly typeRef: 'PartnerLinkStructure'; + }; + readonly additionalLinks: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly maxPartnerLinks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly applicationFormData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly applicationFormPublishedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly landerData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly landerPublishedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly logo: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly wordmark: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly brandColor: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly holdingPeriodDays: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly autoApprovePartnersEnabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly workflowId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utmTemplateId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['clickRewardId'] }, + { readonly columns: readonly ['leadRewardId'] }, + { readonly columns: readonly ['saleRewardId'] }, + { readonly columns: readonly ['discountId'] }, + { readonly columns: readonly ['workflowId'] }, + { readonly columns: readonly ['utmTemplateId'] }, + { readonly columns: readonly ['programId', 'slug'] }, + ]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['clickRewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['leadRewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['saleRewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['discountId']; + readonly references: { readonly table: 'Discount'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['workflowId']; + readonly references: { readonly table: 'Workflow'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['utmTemplateId']; + readonly references: { + readonly table: 'UtmTemplate'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerGroupDefaultLink: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly groupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly domain: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly url: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['groupId', 'url'] }]; + indexes: readonly [{ readonly columns: readonly ['programId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['groupId']; + readonly references: { + readonly table: 'PartnerGroup'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerIndustryInterest: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly industryInterest: { + readonly nativeType: 'IndustryInterest'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'IndustryInterest'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['partnerId', 'industryInterest'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerInvite: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly role: { + readonly nativeType: 'PartnerRole'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'member'>; + }; + readonly typeRef: 'PartnerRole'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['email', 'partnerId'] }]; + indexes: readonly [{ readonly columns: readonly ['partnerId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerNotificationPreferences: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerUserId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly commissionCreated: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly applicationApproved: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly newMessageFromProgram: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly marketingCampaign: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly connectPayoutReminder: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly monthlyProgramSummary: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['partnerUserId'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerUserId']; + readonly references: { + readonly table: 'PartnerUser'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerPlatform: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly type: { + readonly nativeType: 'PlatformType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'PlatformType'; + }; + readonly identifier: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly platformId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly avatarUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly subscribers: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly posts: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly views: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly metadata: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly verifiedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly lastCheckedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['partnerId', 'type'] }]; + indexes: readonly [{ readonly columns: readonly ['type'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerPreferredEarningStructure: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly preferredEarningStructure: { + readonly nativeType: 'PreferredEarningStructure'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'PreferredEarningStructure'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['partnerId', 'preferredEarningStructure'] }, + ]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerReferral: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly customerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly company: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly formData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly status: { + readonly nativeType: 'ReferralStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'ReferralStatus'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['customerId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['customerId']; + readonly references: { readonly table: 'Customer'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerRewind: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly year: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly totalClicks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly totalLeads: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly totalRevenue: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly totalEarnings: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly sentAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['partnerId', 'year'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerSalesChannel: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly salesChannel: { + readonly nativeType: 'SalesChannel'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'SalesChannel'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['partnerId', 'salesChannel'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PartnerUser: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly role: { + readonly nativeType: 'PartnerRole'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'member'>; + }; + readonly typeRef: 'PartnerRole'; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['userId', 'partnerId'] }]; + indexes: readonly [{ readonly columns: readonly ['partnerId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly PasswordResetToken: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly identifier: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly token: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['token'] }, + { readonly columns: readonly ['identifier', 'token'] }, + ]; + indexes: readonly []; + foreignKeys: readonly []; + }; + readonly Payout: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly invoiceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly amount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly currency: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/text@1', 'USD'>; + }; + }; + readonly status: { + readonly nativeType: 'PayoutStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'PayoutStatus'; + }; + readonly mode: { + readonly nativeType: 'PayoutMode'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'PayoutMode'; + }; + readonly method: { + readonly nativeType: 'PartnerPayoutMethod'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'PartnerPayoutMethod'; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly periodStart: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly periodEnd: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly paypalTransferId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripeTransferId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripePayoutId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripePayoutTraceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly failureReason: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly webhookEventId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly initiatedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly paidAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['paypalTransferId'] }, + { readonly columns: readonly ['webhookEventId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['programId', 'status'] }, + { readonly columns: readonly ['programId', 'partnerId'] }, + { readonly columns: readonly ['partnerId'] }, + { readonly columns: readonly ['invoiceId'] }, + { readonly columns: readonly ['status'] }, + { readonly columns: readonly ['method'] }, + { readonly columns: readonly ['userId'] }, + { readonly columns: readonly ['stripePayoutId'] }, + { readonly columns: readonly ['stripeTransferId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId', 'partnerId']; + readonly references: { + readonly table: 'ProgramEnrollment'; + readonly columns: readonly ['programId', 'partnerId']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['invoiceId']; + readonly references: { readonly table: 'Invoice'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Postback: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly url: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly secret: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly triggers: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly receiver: { + readonly nativeType: 'PostbackReceiver'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'PostbackReceiver'; + }; + readonly disabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [{ readonly columns: readonly ['partnerId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Program: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly workspaceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly defaultFolderId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly defaultGroupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly domain: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly url: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly logo: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly primaryRewardEvent: { + readonly nativeType: 'EventType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'sale'>; + }; + readonly typeRef: 'EventType'; + }; + readonly minPayoutAmount: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly payoutMode: { + readonly nativeType: 'ProgramPayoutMode'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'internal'>; + }; + readonly typeRef: 'ProgramPayoutMode'; + }; + readonly inviteEmailData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly embedData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly resources: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly referralFormData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly applicationRequirements: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly termsUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly helpUrl: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly supportEmail: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly messagingEnabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly partnerNetworkEnabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly startedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly deactivatedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly addedToMarketplaceAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly featuredOnMarketplaceAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly marketplaceHeaderImage: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly marketplaceRanking: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 2147483647>; + }; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['slug'] }, + { readonly columns: readonly ['domain'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['workspaceId'] }, + { readonly columns: readonly ['addedToMarketplaceAt'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['workspaceId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['domain']; + readonly references: { readonly table: 'Domain'; readonly columns: readonly ['slug'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ProgramApplication: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly groupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly country: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly website: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly youtube: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly twitter: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly linkedin: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly instagram: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly tiktok: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly formData: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly rejectionReason: { + readonly nativeType: 'ProgramApplicationRejectionReason'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'ProgramApplicationRejectionReason'; + }; + readonly rejectionNote: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly reviewedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId'] }, + { readonly columns: readonly ['groupId'] }, + { readonly columns: readonly ['email'] }, + { readonly columns: readonly ['userId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['groupId']; + readonly references: { + readonly table: 'PartnerGroup'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ProgramApplicationEvent: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly visitedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly startedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly submittedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly approvedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly rejectedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly country: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly referralSource: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly referredByPartnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly metadata: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly programApplicationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['programId', 'partnerId'] }]; + indexes: readonly [ + { readonly columns: readonly ['programId', 'visitedAt'] }, + { readonly columns: readonly ['programId', 'startedAt'] }, + { readonly columns: readonly ['programId', 'submittedAt'] }, + { readonly columns: readonly ['programId', 'approvedAt'] }, + { readonly columns: readonly ['programId', 'country'] }, + { readonly columns: readonly ['programId', 'referralSource'] }, + { readonly columns: readonly ['programId', 'referredByPartnerId'] }, + { readonly columns: readonly ['referredByPartnerId'] }, + { readonly columns: readonly ['programApplicationId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['referredByPartnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programApplicationId']; + readonly references: { + readonly table: 'ProgramApplication'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ProgramCategory: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly category: { + readonly nativeType: 'Category'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'Category'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['programId', 'category'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ProgramEnrollment: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly partnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly tenantId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly groupId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly applicationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly clickRewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly leadRewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly saleRewardId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly discountId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly status: { + readonly nativeType: 'ProgramEnrollmentStatus'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'pending'>; + }; + readonly typeRef: 'ProgramEnrollmentStatus'; + }; + readonly totalClicks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly totalLeads: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly totalConversions: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly totalSales: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly totalSaleAmount: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly totalCommissions: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly netRevenue: { + readonly nativeType: 'int8'; + readonly codecId: 'pg/int8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int8@1', 0>; + }; + }; + readonly earningsPerClick: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/float8@1', 0>; + }; + }; + readonly averageLifetimeValue: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: true; + }; + readonly clickToLeadRate: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: true; + }; + readonly clickToConversionRate: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: true; + }; + readonly leadToConversionRate: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: true; + }; + readonly returnOnAdSpend: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: true; + }; + readonly lastConversionAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly daysSinceLastConversion: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly consistencyScore: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly customerDataSharingEnabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly groupMoveDisabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly bannedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly bannedReason: { + readonly nativeType: 'PartnerBannedReason'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'PartnerBannedReason'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['applicationId'] }, + { readonly columns: readonly ['partnerId', 'programId'] }, + { readonly columns: readonly ['tenantId', 'programId'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['programId', 'status', 'totalClicks'] }, + { readonly columns: readonly ['programId', 'status', 'totalLeads'] }, + { readonly columns: readonly ['programId', 'status', 'totalConversions'] }, + { readonly columns: readonly ['programId', 'status', 'totalSaleAmount'] }, + { readonly columns: readonly ['programId', 'status', 'totalCommissions'] }, + { readonly columns: readonly ['programId', 'status', 'netRevenue'] }, + { readonly columns: readonly ['programId', 'status', 'earningsPerClick'] }, + { readonly columns: readonly ['programId', 'status', 'averageLifetimeValue'] }, + { readonly columns: readonly ['programId', 'status', 'clickToLeadRate'] }, + { readonly columns: readonly ['programId', 'status', 'clickToConversionRate'] }, + { readonly columns: readonly ['programId', 'status', 'leadToConversionRate'] }, + { readonly columns: readonly ['programId', 'status', 'returnOnAdSpend'] }, + { readonly columns: readonly ['programId', 'groupId'] }, + { readonly columns: readonly ['groupId', 'status'] }, + { readonly columns: readonly ['clickRewardId'] }, + { readonly columns: readonly ['leadRewardId'] }, + { readonly columns: readonly ['saleRewardId'] }, + { readonly columns: readonly ['discountId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['partnerId']; + readonly references: { readonly table: 'Partner'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['groupId']; + readonly references: { + readonly table: 'PartnerGroup'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['applicationId']; + readonly references: { + readonly table: 'ProgramApplication'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['clickRewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['leadRewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['saleRewardId']; + readonly references: { readonly table: 'Reward'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['discountId']; + readonly references: { readonly table: 'Discount'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ProgramSimilarity: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly similarProgramId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly similarityScore: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: false; + }; + readonly categorySimilarityScore: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: false; + }; + readonly partnerSimilarityScore: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: false; + }; + readonly performanceSimilarityScore: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['programId', 'similarProgramId'] }]; + indexes: readonly [ + { readonly columns: readonly ['programId', 'similarityScore'] }, + { readonly columns: readonly ['similarProgramId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['similarProgramId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Project: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly logo: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly inviteCode: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly defaultProgramId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly plan: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/text@1', 'free'>; + }; + }; + readonly planTier: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 1>; + }; + }; + readonly planPeriod: { + readonly nativeType: 'PlanPeriod'; + readonly codecId: 'pg/enum@1'; + readonly nullable: true; + readonly typeRef: 'PlanPeriod'; + }; + readonly stripeId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly billingCycleStart: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly billingCycleEndsAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly trialEndsAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly subscriptionCanceledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly paymentFailedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly invoicePrefix: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly stripeConnectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly shopifyStoreId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly totalLinks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly totalClicks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly usage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly usageLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 1000>; + }; + }; + readonly linksUsage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly linksLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 25>; + }; + }; + readonly payoutsUsage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly payoutsLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly payoutFee: { + readonly nativeType: 'float8'; + readonly codecId: 'pg/float8@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/float8@1', 0.05>; + }; + }; + readonly payoutFeeWaiverLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly payoutFeeWaiverUsage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly domainsLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 3>; + }; + }; + readonly tagsLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 5>; + }; + }; + readonly foldersUsage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly foldersLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly partnersUsage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly partnersLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly groupsLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly usersLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 1>; + }; + }; + readonly aiUsage: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly aiLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 10>; + }; + }; + readonly networkInvitesLimit: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly referralLinkId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly referredSignups: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly store: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly siteVisitTrackingSettings: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly allowedHostnames: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly publishableKey: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly conversionEnabled: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly webhookEnabled: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly dotLinkClaimed: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly fastDirectDebitPayouts: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly ssoEmailDomain: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly ssoEnforcedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly usageLastChecked: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['slug'] }, + { readonly columns: readonly ['inviteCode'] }, + { readonly columns: readonly ['defaultProgramId'] }, + { readonly columns: readonly ['stripeId'] }, + { readonly columns: readonly ['invoicePrefix'] }, + { readonly columns: readonly ['stripeConnectId'] }, + { readonly columns: readonly ['shopifyStoreId'] }, + { readonly columns: readonly ['referralLinkId'] }, + { readonly columns: readonly ['publishableKey'] }, + { readonly columns: readonly ['ssoEmailDomain'] }, + ]; + indexes: readonly [ + { readonly columns: readonly ['usageLastChecked'] }, + { readonly columns: readonly ['trialEndsAt'] }, + ]; + foreignKeys: readonly []; + }; + readonly ProjectInvite: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly role: { + readonly nativeType: 'WorkspaceRole'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'member'>; + }; + readonly typeRef: 'WorkspaceRole'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['email', 'projectId'] }]; + indexes: readonly [{ readonly columns: readonly ['projectId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly ProjectUsers: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly role: { + readonly nativeType: 'WorkspaceRole'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'member'>; + }; + readonly typeRef: 'WorkspaceRole'; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly workspacePreferences: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: true; + }; + readonly defaultFolderId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['userId', 'projectId'] }]; + indexes: readonly [{ readonly columns: readonly ['projectId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly RegisteredDomain: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly slug: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly domainId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly autoRenewalDisabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly renewalFee: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 1200>; + }; + }; + readonly expiresAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['domainId'] }]; + indexes: readonly [ + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['expiresAt'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['domainId']; + readonly references: { readonly table: 'Domain'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly RestrictedToken: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly hashedKey: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partialKey: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly scopes: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly lastUsed: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly installationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['hashedKey'] }]; + indexes: readonly [ + { readonly columns: readonly ['userId'] }, + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['installationId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['installationId']; + readonly references: { + readonly table: 'InstalledIntegration'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Reward: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly description: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly tooltipDescription: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly event: { + readonly nativeType: 'EventType'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'EventType'; + }; + readonly type: { + readonly nativeType: 'RewardStructure'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'percentage'>; + }; + readonly typeRef: 'RewardStructure'; + }; + readonly amountInCents: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly amountInPercentage: { + readonly nativeType: 'numeric'; + readonly codecId: 'pg/numeric@1'; + readonly nullable: true; + readonly typeRef: 'Numeric5p2'; + }; + readonly maxDuration: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: true; + }; + readonly modifiers: { + readonly nativeType: 'json'; + readonly codecId: 'pg/json@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['programId', 'event'] }, + { readonly columns: readonly ['event'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly SentEmail: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly type: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [{ readonly columns: readonly ['projectId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Session: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly sessionToken: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['sessionToken'] }]; + indexes: readonly [{ readonly columns: readonly ['userId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Tag: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly color: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/text@1', 'blue'>; + }; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['name', 'projectId'] }]; + indexes: readonly [{ readonly columns: readonly ['projectId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Token: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly hashedKey: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly partialKey: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly lastUsed: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['hashedKey'] }]; + indexes: readonly [{ readonly columns: readonly ['userId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly User: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly email: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly emailVerified: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly image: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly isMachine: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly passwordHash: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly invalidLoginAttempts: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly lockedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly defaultWorkspace: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly defaultPartnerId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly source: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly sentMail: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', false>; + }; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['email'] }]; + indexes: readonly [ + { readonly columns: readonly ['sentMail'] }, + { readonly columns: readonly ['source'] }, + { readonly columns: readonly ['defaultWorkspace'] }, + ]; + foreignKeys: readonly []; + }; + readonly UserNotificationPreferences: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly dubLinks: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly dubPartners: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + readonly partnerAccount: { + readonly nativeType: 'bool'; + readonly codecId: 'pg/bool@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/bool@1', true>; + }; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['userId'] }]; + indexes: readonly []; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly UtmTemplate: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly utm_source: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_medium: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_campaign: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_term: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly utm_content: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly ref: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly userId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [{ readonly columns: readonly ['projectId', 'name'] }]; + indexes: readonly [{ readonly columns: readonly ['userId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['userId']; + readonly references: { readonly table: 'User'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly VerificationToken: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly identifier: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly token: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly expires: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly [ + { readonly columns: readonly ['token'] }, + { readonly columns: readonly ['identifier', 'token'] }, + ]; + indexes: readonly []; + foreignKeys: readonly []; + }; + readonly Webhook: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly projectId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly installationId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly receiver: { + readonly nativeType: 'WebhookReceiver'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/enum@1', 'user'>; + }; + readonly typeRef: 'WebhookReceiver'; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly url: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly secret: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly triggers: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly consecutiveFailures: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + readonly default: { + readonly kind: 'literal'; + readonly value: DefaultLiteralValue<'pg/int4@1', 0>; + }; + }; + readonly lastFailedAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly disabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [ + { readonly columns: readonly ['projectId'] }, + { readonly columns: readonly ['installationId'] }, + ]; + foreignKeys: readonly [ + { + readonly columns: readonly ['projectId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + { + readonly columns: readonly ['installationId']; + readonly references: { + readonly table: 'InstalledIntegration'; + readonly columns: readonly ['id']; + }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly Workflow: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly programId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly name: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: true; + }; + readonly trigger: { + readonly nativeType: 'WorkflowTrigger'; + readonly codecId: 'pg/enum@1'; + readonly nullable: false; + readonly typeRef: 'WorkflowTrigger'; + }; + readonly triggerConditions: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly actions: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly disabledAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly updatedAt: { + readonly nativeType: 'timestamptz'; + readonly codecId: 'pg/timestamptz@1'; + readonly nullable: false; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [{ readonly columns: readonly ['programId', 'trigger'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['programId']; + readonly references: { readonly table: 'Program'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + readonly YearInReview: { + columns: { + readonly id: { + readonly nativeType: 'character'; + readonly codecId: 'sql/char@1'; + readonly nullable: false; + readonly typeParams: { readonly length: 24 }; + }; + readonly year: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly totalLinks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly totalClicks: { + readonly nativeType: 'int4'; + readonly codecId: 'pg/int4@1'; + readonly nullable: false; + }; + readonly topLinks: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly topCountries: { + readonly nativeType: 'jsonb'; + readonly codecId: 'pg/jsonb@1'; + readonly nullable: false; + }; + readonly workspaceId: { + readonly nativeType: 'text'; + readonly codecId: 'pg/text@1'; + readonly nullable: false; + }; + readonly createdAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: false; + readonly default: { readonly kind: 'function'; readonly expression: 'now()' }; + readonly typeRef: 'Timestamp3'; + }; + readonly sentAt: { + readonly nativeType: 'timestamp'; + readonly codecId: 'pg/timestamp@1'; + readonly nullable: true; + readonly typeRef: 'Timestamp3'; + }; + }; + primaryKey: { readonly columns: readonly ['id'] }; + uniques: readonly []; + indexes: readonly [{ readonly columns: readonly ['workspaceId'] }]; + foreignKeys: readonly [ + { + readonly columns: readonly ['workspaceId']; + readonly references: { readonly table: 'Project'; readonly columns: readonly ['id'] }; + readonly constraint: true; + readonly index: true; + }, + ]; + }; + }; + readonly types: { + readonly ProgramApplicationRejectionReason: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'ProgramApplicationRejectionReason'; + readonly typeParams: { + readonly values: readonly [ + 'needsMoreDetail', + 'doesNotMeetRequirements', + 'notTheRightFit', + 'other', + ]; + }; + }; + readonly BountyType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'BountyType'; + readonly typeParams: { readonly values: readonly ['performance', 'submission'] }; + }; + readonly BountyPerformanceScope: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'BountyPerformanceScope'; + readonly typeParams: { readonly values: readonly ['new', 'lifetime'] }; + }; + readonly BountySubmissionStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'BountySubmissionStatus'; + readonly typeParams: { + readonly values: readonly ['draft', 'submitted', 'approved', 'rejected']; + }; + }; + readonly BountySubmissionRejectionReason: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'BountySubmissionRejectionReason'; + readonly typeParams: { + readonly values: readonly [ + 'invalidProof', + 'duplicateSubmission', + 'outOfTimeWindow', + 'didNotMeetCriteria', + 'other', + ]; + }; + }; + readonly BountySubmissionFrequency: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'BountySubmissionFrequency'; + readonly typeParams: { readonly values: readonly ['day', 'week', 'month'] }; + }; + readonly CampaignType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'CampaignType'; + readonly typeParams: { readonly values: readonly ['marketing', 'transactional'] }; + }; + readonly CampaignStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'CampaignStatus'; + readonly typeParams: { + readonly values: readonly [ + 'draft', + 'active', + 'paused', + 'scheduled', + 'sending', + 'sent', + 'canceled', + ]; + }; + }; + readonly CommissionStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'CommissionStatus'; + readonly typeParams: { + readonly values: readonly [ + 'pending', + 'processed', + 'paid', + 'refunded', + 'duplicate', + 'fraud', + 'canceled', + ]; + }; + }; + readonly CommissionType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'CommissionType'; + readonly typeParams: { readonly values: readonly ['click', 'lead', 'sale', 'custom'] }; + }; + readonly DiscountProvider: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'DiscountProvider'; + readonly typeParams: { readonly values: readonly ['stripe', 'shopify'] }; + }; + readonly EmailDomainStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'EmailDomainStatus'; + readonly typeParams: { + readonly values: readonly [ + 'pending', + 'verified', + 'failed', + 'temporary_failure', + 'not_started', + ]; + }; + }; + readonly FolderType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'FolderType'; + readonly typeParams: { readonly values: readonly ['default', 'mega'] }; + }; + readonly FolderAccessLevel: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'FolderAccessLevel'; + readonly typeParams: { readonly values: readonly ['read', 'write'] }; + }; + readonly FolderUserRole: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'FolderUserRole'; + readonly typeParams: { readonly values: readonly ['owner', 'editor', 'viewer'] }; + }; + readonly FraudEventStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'FraudEventStatus'; + readonly typeParams: { readonly values: readonly ['pending', 'resolved'] }; + }; + readonly FraudRuleType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'FraudRuleType'; + readonly typeParams: { + readonly values: readonly [ + 'customerEmailMatch', + 'customerEmailSuspiciousDomain', + 'referralSourceBanned', + 'paidTrafficDetected', + 'partnerCrossProgramBan', + 'partnerDuplicateAccount', + ]; + }; + }; + readonly FraudAlertStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'FraudAlertStatus'; + readonly typeParams: { readonly values: readonly ['pending', 'confirmed', 'dismissed'] }; + }; + readonly PartnerLinkStructure: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PartnerLinkStructure'; + readonly typeParams: { readonly values: readonly ['short', 'query', 'path'] }; + }; + readonly InvoiceStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'InvoiceStatus'; + readonly typeParams: { readonly values: readonly ['processing', 'completed', 'failed'] }; + }; + readonly InvoiceType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'InvoiceType'; + readonly typeParams: { readonly values: readonly ['partnerPayout', 'domainRenewal'] }; + }; + readonly PaymentMethod: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PaymentMethod'; + readonly typeParams: { + readonly values: readonly ['card', 'ach', 'ach_fast', 'sepa', 'acss']; + }; + }; + readonly MessageType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'MessageType'; + readonly typeParams: { readonly values: readonly ['direct', 'campaign'] }; + }; + readonly Category: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'Category'; + readonly typeParams: { + readonly values: readonly [ + 'Artificial_Intelligence', + 'Development', + 'Design', + 'Productivity', + 'Finance', + 'Marketing', + 'Ecommerce', + 'Security', + 'Education', + 'Health', + 'Consumer', + ]; + }; + }; + readonly IndustryInterest: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'IndustryInterest'; + readonly typeParams: { + readonly values: readonly [ + 'SaaS', + 'DevTool', + 'AI', + 'Creative_And_Design', + 'Productivity_Software', + 'Marketing', + 'Gaming', + 'Finance', + 'Sales', + 'Ecommerce', + 'Customer_Service_And_Support', + 'Content_Management', + 'Human_Resources', + 'Security', + 'Analytics_And_Data', + 'Social_Media', + 'Consumer_Tech', + 'Education_And_Learning', + 'Health_And_Fitness', + 'Food_And_Beverage', + 'Travel_And_Lifestyle', + 'Entertainment_And_Media', + 'Sports', + 'Science_And_Engineering', + ]; + }; + }; + readonly NotificationEmailType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'NotificationEmailType'; + readonly typeParams: { readonly values: readonly ['Message', 'Bounty', 'Campaign'] }; + }; + readonly PartnerRole: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PartnerRole'; + readonly typeParams: { readonly values: readonly ['owner', 'member'] }; + }; + readonly PartnerProfileType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PartnerProfileType'; + readonly typeParams: { readonly values: readonly ['individual', 'company'] }; + }; + readonly MonthlyTraffic: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'MonthlyTraffic'; + readonly typeParams: { + readonly values: readonly [ + 'ZeroToOneThousand', + 'OneThousandToTenThousand', + 'TenThousandToFiftyThousand', + 'FiftyThousandToOneHundredThousand', + 'OneHundredThousandPlus', + ]; + }; + }; + readonly PartnerPayoutMethod: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PartnerPayoutMethod'; + readonly typeParams: { readonly values: readonly ['connect', 'stablecoin', 'paypal'] }; + }; + readonly IdentityVerificationStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'IdentityVerificationStatus'; + readonly typeParams: { + readonly values: readonly [ + 'started', + 'submitted', + 'approved', + 'declined', + 'resubmissionRequested', + 'expired', + 'abandoned', + 'review', + ]; + }; + }; + readonly PreferredEarningStructure: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PreferredEarningStructure'; + readonly typeParams: { + readonly values: readonly [ + 'Revenue_Share', + 'Per_Lead', + 'Per_Sale', + 'Per_Click', + 'One_Time_Payment', + ]; + }; + }; + readonly SalesChannel: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'SalesChannel'; + readonly typeParams: { + readonly values: readonly [ + 'Blogs', + 'Coupons', + 'Direct_Reselling', + 'Newsletters', + 'Social_Media', + 'Events', + 'Company_Referrals', + ]; + }; + }; + readonly PayoutStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PayoutStatus'; + readonly typeParams: { + readonly values: readonly [ + 'pending', + 'processing', + 'processed', + 'sent', + 'completed', + 'failed', + 'canceled', + ]; + }; + }; + readonly PayoutMode: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PayoutMode'; + readonly typeParams: { readonly values: readonly ['internal', 'external'] }; + }; + readonly PlatformType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PlatformType'; + readonly typeParams: { + readonly values: readonly [ + 'website', + 'youtube', + 'twitter', + 'linkedin', + 'instagram', + 'tiktok', + ]; + }; + }; + readonly PostbackReceiver: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PostbackReceiver'; + readonly typeParams: { readonly values: readonly ['custom', 'slack'] }; + }; + readonly ProgramEnrollmentStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'ProgramEnrollmentStatus'; + readonly typeParams: { + readonly values: readonly [ + 'pending', + 'approved', + 'rejected', + 'invited', + 'declined', + 'deactivated', + 'banned', + 'archived', + ]; + }; + }; + readonly PartnerBannedReason: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PartnerBannedReason'; + readonly typeParams: { + readonly values: readonly [ + 'tos_violation', + 'inappropriate_content', + 'fake_traffic', + 'fraud', + 'spam', + 'brand_abuse', + ]; + }; + }; + readonly ProgramPayoutMode: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'ProgramPayoutMode'; + readonly typeParams: { readonly values: readonly ['internal', 'hybrid', 'external'] }; + }; + readonly ReferralStatus: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'ReferralStatus'; + readonly typeParams: { + readonly values: readonly [ + 'pending', + 'qualified', + 'meeting', + 'negotiation', + 'unqualified', + 'closedWon', + 'closedLost', + ]; + }; + }; + readonly EventType: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'EventType'; + readonly typeParams: { readonly values: readonly ['click', 'lead', 'sale'] }; + }; + readonly RewardStructure: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'RewardStructure'; + readonly typeParams: { readonly values: readonly ['percentage', 'flat'] }; + }; + readonly WebhookReceiver: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'WebhookReceiver'; + readonly typeParams: { + readonly values: readonly ['user', 'zapier', 'make', 'slack', 'segment']; + }; + }; + readonly WorkflowTrigger: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'WorkflowTrigger'; + readonly typeParams: { + readonly values: readonly [ + 'partnerEnrolled', + 'partnerMetricsUpdated', + 'clickRecorded', + 'commissionEarned', + 'leadRecorded', + 'saleRecorded', + ]; + }; + }; + readonly PlanPeriod: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'PlanPeriod'; + readonly typeParams: { + readonly values: readonly ['monthly', 'yearly', 'quarterly', 'biweekly']; + }; + }; + readonly WorkspaceRole: { + readonly codecId: 'pg/enum@1'; + readonly nativeType: 'WorkspaceRole'; + readonly typeParams: { readonly values: readonly ['owner', 'member', 'viewer', 'billing'] }; + }; + readonly JsonData: { + readonly codecId: 'pg/json@1'; + readonly nativeType: 'json'; + readonly typeParams: Record; + }; + readonly Numeric5p2: { + readonly codecId: 'pg/numeric@1'; + readonly nativeType: 'numeric'; + readonly typeParams: { readonly precision: 5; readonly scale: 2 }; + }; + readonly Timestamp0: { + readonly codecId: 'pg/timestamp@1'; + readonly nativeType: 'timestamp'; + readonly typeParams: Record; + }; + readonly Timestamp3: { + readonly codecId: 'pg/timestamp@1'; + readonly nativeType: 'timestamp'; + readonly typeParams: { readonly precision: 3 }; + }; + readonly VarChar64: { + readonly codecId: 'sql/varchar@1'; + readonly nativeType: 'character varying'; + readonly typeParams: { readonly length: 64 }; + }; + readonly VarChar250: { + readonly codecId: 'sql/varchar@1'; + readonly nativeType: 'character varying'; + readonly typeParams: { readonly length: 250 }; + }; + readonly VarChar280: { + readonly codecId: 'sql/varchar@1'; + readonly nativeType: 'character varying'; + readonly typeParams: { readonly length: 280 }; + }; + readonly VarChar400: { + readonly codecId: 'sql/varchar@1'; + readonly nativeType: 'character varying'; + readonly typeParams: { readonly length: 400 }; + }; + }; + readonly storageHash: StorageHash; + }, + { + readonly Account: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly provider: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly providerAccountId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly refresh_token: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly refresh_token_expires_in: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly access_token: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires_at: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly token_type: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly scope: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly id_token: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly session_state: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Account'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly userId: { readonly column: 'userId' }; + readonly type: { readonly column: 'type' }; + readonly provider: { readonly column: 'provider' }; + readonly providerAccountId: { readonly column: 'providerAccountId' }; + readonly refresh_token: { readonly column: 'refresh_token' }; + readonly refresh_token_expires_in: { readonly column: 'refresh_token_expires_in' }; + readonly access_token: { readonly column: 'access_token' }; + readonly expires_at: { readonly column: 'expires_at' }; + readonly token_type: { readonly column: 'token_type' }; + readonly scope: { readonly column: 'scope' }; + readonly id_token: { readonly column: 'id_token' }; + readonly session_state: { readonly column: 'session_state' }; + }; + }; + }; + readonly ActivityLog: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly workspaceId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly parentResourceType: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly parentResourceId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly resourceType: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly resourceId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly action: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly batchId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly changeSet: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ActivityLog'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly workspaceId: { readonly column: 'workspaceId' }; + readonly programId: { readonly column: 'programId' }; + readonly parentResourceType: { readonly column: 'parentResourceType' }; + readonly parentResourceId: { readonly column: 'parentResourceId' }; + readonly resourceType: { readonly column: 'resourceType' }; + readonly resourceId: { readonly column: 'resourceId' }; + readonly userId: { readonly column: 'userId' }; + readonly action: { readonly column: 'action' }; + readonly description: { readonly column: 'description' }; + readonly batchId: { readonly column: 'batchId' }; + readonly changeSet: { readonly column: 'changeSet' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly Bounty: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly workflowId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly startsAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly endsAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly submissionsOpenAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly submissionFrequency: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly maxSubmissions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly rewardAmount: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly rewardDescription: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly performanceScope: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly submissionRequirements: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly socialMetricsLastSyncedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly archivedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly emails: { + readonly to: 'NotificationEmail'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['bountyId']; + }; + }; + readonly groups: { + readonly to: 'BountyGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['bountyId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly submissions: { + readonly to: 'BountySubmission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['bountyId']; + }; + }; + readonly workflow: { + readonly to: 'Workflow'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['workflowId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Bounty'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly workflowId: { readonly column: 'workflowId' }; + readonly name: { readonly column: 'name' }; + readonly description: { readonly column: 'description' }; + readonly type: { readonly column: 'type' }; + readonly startsAt: { readonly column: 'startsAt' }; + readonly endsAt: { readonly column: 'endsAt' }; + readonly submissionsOpenAt: { readonly column: 'submissionsOpenAt' }; + readonly submissionFrequency: { readonly column: 'submissionFrequency' }; + readonly maxSubmissions: { readonly column: 'maxSubmissions' }; + readonly rewardAmount: { readonly column: 'rewardAmount' }; + readonly rewardDescription: { readonly column: 'rewardDescription' }; + readonly performanceScope: { readonly column: 'performanceScope' }; + readonly submissionRequirements: { readonly column: 'submissionRequirements' }; + readonly socialMetricsLastSyncedAt: { readonly column: 'socialMetricsLastSyncedAt' }; + readonly archivedAt: { readonly column: 'archivedAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly BountyGroup: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly bountyId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly groupId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly bounty: { + readonly to: 'Bounty'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['bountyId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partnerGroup: { + readonly to: 'PartnerGroup'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['groupId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'BountyGroup'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly bountyId: { readonly column: 'bountyId' }; + readonly groupId: { readonly column: 'groupId' }; + }; + }; + }; + readonly BountySubmission: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly bountyId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly performanceCount: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly socialMetricCount: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly commissionId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly rejectionReason: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly rejectionNote: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly files: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly urls: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly periodNumber: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly socialMetricsLastSyncedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly completedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly reviewedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly bounty: { + readonly to: 'Bounty'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['bountyId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly commission: { + readonly to: 'Commission'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['commissionId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'BountySubmission'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly bountyId: { readonly column: 'bountyId' }; + readonly performanceCount: { readonly column: 'performanceCount' }; + readonly socialMetricCount: { readonly column: 'socialMetricCount' }; + readonly commissionId: { readonly column: 'commissionId' }; + readonly userId: { readonly column: 'userId' }; + readonly description: { readonly column: 'description' }; + readonly status: { readonly column: 'status' }; + readonly rejectionReason: { readonly column: 'rejectionReason' }; + readonly rejectionNote: { readonly column: 'rejectionNote' }; + readonly files: { readonly column: 'files' }; + readonly urls: { readonly column: 'urls' }; + readonly periodNumber: { readonly column: 'periodNumber' }; + readonly socialMetricsLastSyncedAt: { readonly column: 'socialMetricsLastSyncedAt' }; + readonly completedAt: { readonly column: 'completedAt' }; + readonly reviewedAt: { readonly column: 'reviewedAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Campaign: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly workflowId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly qstashMessageId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly subject: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly preview: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly from: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly bodyJson: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly scheduledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly emails: { + readonly to: 'NotificationEmail'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['campaignId']; + }; + }; + readonly groups: { + readonly to: 'CampaignGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['campaignId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly workflow: { + readonly to: 'Workflow'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['workflowId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Campaign'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly workflowId: { readonly column: 'workflowId' }; + readonly userId: { readonly column: 'userId' }; + readonly qstashMessageId: { readonly column: 'qstashMessageId' }; + readonly type: { readonly column: 'type' }; + readonly status: { readonly column: 'status' }; + readonly name: { readonly column: 'name' }; + readonly subject: { readonly column: 'subject' }; + readonly preview: { readonly column: 'preview' }; + readonly from: { readonly column: 'from' }; + readonly bodyJson: { readonly column: 'bodyJson' }; + readonly scheduledAt: { readonly column: 'scheduledAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly CampaignGroup: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly campaignId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly groupId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly campaign: { + readonly to: 'Campaign'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['campaignId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partnerGroup: { + readonly to: 'PartnerGroup'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['groupId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'CampaignGroup'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly campaignId: { readonly column: 'campaignId' }; + readonly groupId: { readonly column: 'groupId' }; + }; + }; + }; + readonly Commission: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly rewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly payoutId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly invoiceId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly customerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly eventId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly amount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly quantity: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly earnings: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly currency: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly customer: { + readonly to: 'Customer'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['customerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly payout: { + readonly to: 'Payout'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['payoutId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly reward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['rewardId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Commission'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly rewardId: { readonly column: 'rewardId' }; + readonly linkId: { readonly column: 'linkId' }; + readonly payoutId: { readonly column: 'payoutId' }; + readonly invoiceId: { readonly column: 'invoiceId' }; + readonly customerId: { readonly column: 'customerId' }; + readonly eventId: { readonly column: 'eventId' }; + readonly description: { readonly column: 'description' }; + readonly type: { readonly column: 'type' }; + readonly amount: { readonly column: 'amount' }; + readonly quantity: { readonly column: 'quantity' }; + readonly earnings: { readonly column: 'earnings' }; + readonly currency: { readonly column: 'currency' }; + readonly status: { readonly column: 'status' }; + readonly userId: { readonly column: 'userId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Customer: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly email: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly avatar: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly externalId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripeCustomerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly clickId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly clickedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly country: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly sales: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly saleAmount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly firstSaleAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly subscriptionCanceledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectConnectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['customerId']; + }; + }; + readonly fraudEvents: { + readonly to: 'FraudEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['customerId']; + }; + }; + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly referrals: { + readonly to: 'PartnerReferral'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['customerId']; + }; + }; + }; + readonly storage: { + readonly table: 'Customer'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly email: { readonly column: 'email' }; + readonly avatar: { readonly column: 'avatar' }; + readonly externalId: { readonly column: 'externalId' }; + readonly stripeCustomerId: { readonly column: 'stripeCustomerId' }; + readonly linkId: { readonly column: 'linkId' }; + readonly clickId: { readonly column: 'clickId' }; + readonly clickedAt: { readonly column: 'clickedAt' }; + readonly country: { readonly column: 'country' }; + readonly sales: { readonly column: 'sales' }; + readonly saleAmount: { readonly column: 'saleAmount' }; + readonly firstSaleAt: { readonly column: 'firstSaleAt' }; + readonly subscriptionCanceledAt: { readonly column: 'subscriptionCanceledAt' }; + readonly projectId: { readonly column: 'projectId' }; + readonly projectConnectId: { readonly column: 'projectConnectId' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Dashboard: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly linkId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly folderId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly doIndex: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly password: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly showConversions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly folder: { + readonly to: 'Folder'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['folderId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Dashboard'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly linkId: { readonly column: 'linkId' }; + readonly folderId: { readonly column: 'folderId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly userId: { readonly column: 'userId' }; + readonly doIndex: { readonly column: 'doIndex' }; + readonly password: { readonly column: 'password' }; + readonly showConversions: { readonly column: 'showConversions' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly DefaultDomains: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly dubsh: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly chatgpt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly sptifi: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly gitnew: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly callink: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly amznid: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly ggllink: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly figpage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly loooooooong: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'DefaultDomains'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly dubsh: { readonly column: 'dubsh' }; + readonly chatgpt: { readonly column: 'chatgpt' }; + readonly sptifi: { readonly column: 'sptifi' }; + readonly gitnew: { readonly column: 'gitnew' }; + readonly callink: { readonly column: 'callink' }; + readonly amznid: { readonly column: 'amznid' }; + readonly ggllink: { readonly column: 'ggllink' }; + readonly figpage: { readonly column: 'figpage' }; + readonly loooooooong: { readonly column: 'loooooooong' }; + readonly projectId: { readonly column: 'projectId' }; + }; + }; + }; + readonly Discount: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly amount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly maxDuration: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly couponId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly couponTestId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly autoProvisionEnabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly provider: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly discountCodes: { + readonly to: 'DiscountCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['discountId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollments: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['discountId']; + }; + }; + }; + readonly storage: { + readonly table: 'Discount'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly amount: { readonly column: 'amount' }; + readonly type: { readonly column: 'type' }; + readonly maxDuration: { readonly column: 'maxDuration' }; + readonly description: { readonly column: 'description' }; + readonly couponId: { readonly column: 'couponId' }; + readonly couponTestId: { readonly column: 'couponTestId' }; + readonly autoProvisionEnabledAt: { readonly column: 'autoProvisionEnabledAt' }; + readonly provider: { readonly column: 'provider' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly DiscountCode: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly code: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly discountId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly discount: { + readonly to: 'Discount'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['discountId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + }; + readonly storage: { + readonly table: 'DiscountCode'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly code: { readonly column: 'code' }; + readonly programId: { readonly column: 'programId' }; + readonly discountId: { readonly column: 'discountId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly linkId: { readonly column: 'linkId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly DiscoveredPartner: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly starredAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly ignoredAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly invitedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly messagedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + }; + readonly storage: { + readonly table: 'DiscoveredPartner'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly starredAt: { readonly column: 'starredAt' }; + readonly ignoredAt: { readonly column: 'ignoredAt' }; + readonly invitedAt: { readonly column: 'invitedAt' }; + readonly messagedAt: { readonly column: 'messagedAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Domain: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly verified: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly placeholder: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expiredUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly notFoundUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly primary: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly archived: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly lastChecked: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly logo: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly appleAppSiteAssociation: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly assetLinks: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly deepviewData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly linkRetentionDays: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly projectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['slug']; + readonly targetFields: readonly ['domain']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Domain'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly slug: { readonly column: 'slug' }; + readonly verified: { readonly column: 'verified' }; + readonly placeholder: { readonly column: 'placeholder' }; + readonly expiredUrl: { readonly column: 'expiredUrl' }; + readonly notFoundUrl: { readonly column: 'notFoundUrl' }; + readonly primary: { readonly column: 'primary' }; + readonly archived: { readonly column: 'archived' }; + readonly lastChecked: { readonly column: 'lastChecked' }; + readonly logo: { readonly column: 'logo' }; + readonly appleAppSiteAssociation: { readonly column: 'appleAppSiteAssociation' }; + readonly assetLinks: { readonly column: 'assetLinks' }; + readonly deepviewData: { readonly column: 'deepviewData' }; + readonly linkRetentionDays: { readonly column: 'linkRetentionDays' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly projectId: { readonly column: 'projectId' }; + }; + }; + }; + readonly EmailDomain: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly workspaceId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly resendDomainId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly lastChecked: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'EmailDomain'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly workspaceId: { readonly column: 'workspaceId' }; + readonly programId: { readonly column: 'programId' }; + readonly slug: { readonly column: 'slug' }; + readonly status: { readonly column: 'status' }; + readonly resendDomainId: { readonly column: 'resendDomainId' }; + readonly lastChecked: { readonly column: 'lastChecked' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly EmailVerificationToken: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly identifier: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly token: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: Record; + readonly storage: { + readonly table: 'EmailVerificationToken'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly identifier: { readonly column: 'identifier' }; + readonly token: { readonly column: 'token' }; + readonly expires: { readonly column: 'expires' }; + }; + }; + }; + readonly Folder: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly accessLevel: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly accessRequests: { + readonly to: 'FolderAccessRequest'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['folderId']; + }; + }; + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['folderId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly users: { + readonly to: 'FolderUser'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['folderId']; + }; + }; + }; + readonly storage: { + readonly table: 'Folder'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly description: { readonly column: 'description' }; + readonly projectId: { readonly column: 'projectId' }; + readonly type: { readonly column: 'type' }; + readonly accessLevel: { readonly column: 'accessLevel' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly FolderAccessRequest: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly folderId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly folder: { + readonly to: 'Folder'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['folderId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'FolderAccessRequest'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly folderId: { readonly column: 'folderId' }; + readonly userId: { readonly column: 'userId' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly FolderUser: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly folderId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly role: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly folder: { + readonly to: 'Folder'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['folderId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'FolderUser'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly folderId: { readonly column: 'folderId' }; + readonly userId: { readonly column: 'userId' }; + readonly role: { readonly column: 'role' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly FraudAlert: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly reason: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly reviewedById: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly reviewedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly reviewNote: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly reviewedBy: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['reviewedById']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'FraudAlert'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly programId: { readonly column: 'programId' }; + readonly reason: { readonly column: 'reason' }; + readonly status: { readonly column: 'status' }; + readonly reviewedById: { readonly column: 'reviewedById' }; + readonly reviewedAt: { readonly column: 'reviewedAt' }; + readonly reviewNote: { readonly column: 'reviewNote' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly FraudEvent: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly fraudEventGroupId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly customerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly eventId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly sourceProgramId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly hash: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly metadata: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly customer: { + readonly to: 'Customer'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['customerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly fraudEventGroup: { + readonly to: 'FraudEventGroup'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['fraudEventGroupId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly sourceProgram: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['sourceProgramId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'FraudEvent'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly fraudEventGroupId: { readonly column: 'fraudEventGroupId' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly linkId: { readonly column: 'linkId' }; + readonly customerId: { readonly column: 'customerId' }; + readonly eventId: { readonly column: 'eventId' }; + readonly sourceProgramId: { readonly column: 'sourceProgramId' }; + readonly hash: { readonly column: 'hash' }; + readonly metadata: { readonly column: 'metadata' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly FraudEventGroup: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly lastEventAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly eventCount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly resolutionReason: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly resolvedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly fraudEvents: { + readonly to: 'FraudEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['fraudEventGroupId']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'FraudEventGroup'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly type: { readonly column: 'type' }; + readonly lastEventAt: { readonly column: 'lastEventAt' }; + readonly eventCount: { readonly column: 'eventCount' }; + readonly userId: { readonly column: 'userId' }; + readonly resolutionReason: { readonly column: 'resolutionReason' }; + readonly resolvedAt: { readonly column: 'resolvedAt' }; + readonly status: { readonly column: 'status' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly FraudRule: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly config: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly disabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'FraudRule'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly type: { readonly column: 'type' }; + readonly config: { readonly column: 'config' }; + readonly disabledAt: { readonly column: 'disabledAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly InstalledIntegration: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly integrationId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly credentials: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly settings: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + }; + readonly relations: { + readonly accessTokens: { + readonly to: 'RestrictedToken'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['installationId']; + }; + }; + readonly integration: { + readonly to: 'Integration'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['integrationId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly refreshTokens: { + readonly to: 'OAuthRefreshToken'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['installationId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly webhooks: { + readonly to: 'Webhook'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['installationId']; + }; + }; + }; + readonly storage: { + readonly table: 'InstalledIntegration'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly userId: { readonly column: 'userId' }; + readonly integrationId: { readonly column: 'integrationId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly credentials: { readonly column: 'credentials' }; + readonly settings: { readonly column: 'settings' }; + }; + }; + }; + readonly Integration: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly readme: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly developer: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly website: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly logo: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly screenshots: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly verified: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly installUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly guideUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly category: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly comingSoon: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly installations: { + readonly to: 'InstalledIntegration'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['integrationId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Integration'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly userId: { readonly column: 'userId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly name: { readonly column: 'name' }; + readonly slug: { readonly column: 'slug' }; + readonly description: { readonly column: 'description' }; + readonly readme: { readonly column: 'readme' }; + readonly developer: { readonly column: 'developer' }; + readonly website: { readonly column: 'website' }; + readonly logo: { readonly column: 'logo' }; + readonly screenshots: { readonly column: 'screenshots' }; + readonly verified: { readonly column: 'verified' }; + readonly installUrl: { readonly column: 'installUrl' }; + readonly guideUrl: { readonly column: 'guideUrl' }; + readonly category: { readonly column: 'category' }; + readonly comingSoon: { readonly column: 'comingSoon' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Invoice: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly workspaceId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly number: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly payoutMode: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly paymentMethod: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly amount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly fee: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly total: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly externalAmount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly receiptUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly failedReason: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly registeredDomains: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly stripeChargeMetadata: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly failedAttempts: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly paidAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly payouts: { + readonly to: 'Payout'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['invoiceId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly workspace: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['workspaceId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Invoice'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly workspaceId: { readonly column: 'workspaceId' }; + readonly number: { readonly column: 'number' }; + readonly status: { readonly column: 'status' }; + readonly type: { readonly column: 'type' }; + readonly payoutMode: { readonly column: 'payoutMode' }; + readonly paymentMethod: { readonly column: 'paymentMethod' }; + readonly amount: { readonly column: 'amount' }; + readonly fee: { readonly column: 'fee' }; + readonly total: { readonly column: 'total' }; + readonly externalAmount: { readonly column: 'externalAmount' }; + readonly receiptUrl: { readonly column: 'receiptUrl' }; + readonly failedReason: { readonly column: 'failedReason' }; + readonly registeredDomains: { readonly column: 'registeredDomains' }; + readonly stripeChargeMetadata: { readonly column: 'stripeChargeMetadata' }; + readonly failedAttempts: { readonly column: 'failedAttempts' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly paidAt: { readonly column: 'paidAt' }; + }; + }; + }; + readonly jackson_index: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly key: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly storeKey: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + }; + readonly relations: Record; + readonly storage: { + readonly table: 'jackson_index'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly key: { readonly column: 'key' }; + readonly storeKey: { readonly column: 'storeKey' }; + }; + }; + }; + readonly jackson_store: { + readonly fields: { + readonly key: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly value: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly iv: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly tag: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly namespace: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly modifiedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: Record; + readonly storage: { + readonly table: 'jackson_store'; + readonly fields: { + readonly key: { readonly column: 'key' }; + readonly value: { readonly column: 'value' }; + readonly iv: { readonly column: 'iv' }; + readonly tag: { readonly column: 'tag' }; + readonly namespace: { readonly column: 'namespace' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly modifiedAt: { readonly column: 'modifiedAt' }; + }; + }; + }; + readonly jackson_ttl: { + readonly fields: { + readonly key: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly expiresAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + }; + readonly relations: Record; + readonly storage: { + readonly table: 'jackson_ttl'; + readonly fields: { + readonly key: { readonly column: 'key' }; + readonly expiresAt: { readonly column: 'expiresAt' }; + }; + }; + }; + readonly Link: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly domain: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly key: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly url: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly shortLink: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly archived: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly expiresAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly expiredUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly disabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly password: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly trackConversion: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly proxy: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly title: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'sql/varchar@1' }; + }; + readonly image: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly video: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_source: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_medium: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_campaign: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_term: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_content: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly rewrite: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly linkRetentionCleanupDisabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly doIndex: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly ios: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly android: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly geo: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly testVariants: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly testStartedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly testCompletedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly folderId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly externalId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly tenantId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly publicStats: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly clicks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly leads: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly conversions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly sales: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly saleAmount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly lastClicked: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly lastLeadAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly lastConversionAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly comments: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerGroupDefaultLinkId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['linkId']; + }; + }; + readonly customers: { + readonly to: 'Customer'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['linkId']; + }; + }; + readonly folder: { + readonly to: 'Folder'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['folderId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly fraudEvents: { + readonly to: 'FraudEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['linkId']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partnerGroupDefaultLink: { + readonly to: 'PartnerGroupDefaultLink'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerGroupDefaultLinkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly shortDomain: { + readonly to: 'Domain'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['domain']; + readonly targetFields: readonly ['slug']; + }; + }; + readonly tags: { + readonly to: 'LinkTag'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['linkId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly webhooks: { + readonly to: 'LinkWebhook'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['linkId']; + }; + }; + }; + readonly storage: { + readonly table: 'Link'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly domain: { readonly column: 'domain' }; + readonly key: { readonly column: 'key' }; + readonly url: { readonly column: 'url' }; + readonly shortLink: { readonly column: 'shortLink' }; + readonly archived: { readonly column: 'archived' }; + readonly expiresAt: { readonly column: 'expiresAt' }; + readonly expiredUrl: { readonly column: 'expiredUrl' }; + readonly disabledAt: { readonly column: 'disabledAt' }; + readonly password: { readonly column: 'password' }; + readonly trackConversion: { readonly column: 'trackConversion' }; + readonly proxy: { readonly column: 'proxy' }; + readonly title: { readonly column: 'title' }; + readonly description: { readonly column: 'description' }; + readonly image: { readonly column: 'image' }; + readonly video: { readonly column: 'video' }; + readonly utm_source: { readonly column: 'utm_source' }; + readonly utm_medium: { readonly column: 'utm_medium' }; + readonly utm_campaign: { readonly column: 'utm_campaign' }; + readonly utm_term: { readonly column: 'utm_term' }; + readonly utm_content: { readonly column: 'utm_content' }; + readonly rewrite: { readonly column: 'rewrite' }; + readonly linkRetentionCleanupDisabledAt: { + readonly column: 'linkRetentionCleanupDisabledAt'; + }; + readonly doIndex: { readonly column: 'doIndex' }; + readonly ios: { readonly column: 'ios' }; + readonly android: { readonly column: 'android' }; + readonly geo: { readonly column: 'geo' }; + readonly testVariants: { readonly column: 'testVariants' }; + readonly testStartedAt: { readonly column: 'testStartedAt' }; + readonly testCompletedAt: { readonly column: 'testCompletedAt' }; + readonly userId: { readonly column: 'userId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly folderId: { readonly column: 'folderId' }; + readonly externalId: { readonly column: 'externalId' }; + readonly tenantId: { readonly column: 'tenantId' }; + readonly publicStats: { readonly column: 'publicStats' }; + readonly clicks: { readonly column: 'clicks' }; + readonly leads: { readonly column: 'leads' }; + readonly conversions: { readonly column: 'conversions' }; + readonly sales: { readonly column: 'sales' }; + readonly saleAmount: { readonly column: 'saleAmount' }; + readonly lastClicked: { readonly column: 'lastClicked' }; + readonly lastLeadAt: { readonly column: 'lastLeadAt' }; + readonly lastConversionAt: { readonly column: 'lastConversionAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly comments: { readonly column: 'comments' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly partnerGroupDefaultLinkId: { readonly column: 'partnerGroupDefaultLinkId' }; + }; + }; + }; + readonly LinkTag: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly linkId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly tagId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly tag: { + readonly to: 'Tag'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['tagId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'LinkTag'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly linkId: { readonly column: 'linkId' }; + readonly tagId: { readonly column: 'tagId' }; + }; + }; + }; + readonly LinkWebhook: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly linkId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly webhookId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly link: { + readonly to: 'Link'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['linkId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly webhook: { + readonly to: 'Webhook'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['webhookId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'LinkWebhook'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly linkId: { readonly column: 'linkId' }; + readonly webhookId: { readonly column: 'webhookId' }; + }; + }; + }; + readonly Message: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly senderUserId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly senderPartnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly subject: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly text: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly readInApp: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly readInEmail: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly emails: { + readonly to: 'NotificationEmail'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['messageId']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly senderPartner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['senderPartnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly senderUser: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['senderUserId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Message'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly senderUserId: { readonly column: 'senderUserId' }; + readonly senderPartnerId: { readonly column: 'senderPartnerId' }; + readonly type: { readonly column: 'type' }; + readonly subject: { readonly column: 'subject' }; + readonly text: { readonly column: 'text' }; + readonly readInApp: { readonly column: 'readInApp' }; + readonly readInEmail: { readonly column: 'readInEmail' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly NotificationEmail: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly emailId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly messageId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly bountyId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly campaignId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly recipientUserId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly deliveredAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly openedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly bouncedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly bounty: { + readonly to: 'Bounty'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['bountyId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly campaign: { + readonly to: 'Campaign'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['campaignId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly message: { + readonly to: 'Message'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['messageId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'NotificationEmail'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly emailId: { readonly column: 'emailId' }; + readonly type: { readonly column: 'type' }; + readonly messageId: { readonly column: 'messageId' }; + readonly bountyId: { readonly column: 'bountyId' }; + readonly campaignId: { readonly column: 'campaignId' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly recipientUserId: { readonly column: 'recipientUserId' }; + readonly deliveredAt: { readonly column: 'deliveredAt' }; + readonly openedAt: { readonly column: 'openedAt' }; + readonly bouncedAt: { readonly column: 'bouncedAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly NotificationPreference: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly projectUserId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkUsageSummary: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly domainConfigurationUpdates: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly newPartnerSale: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly newPartnerApplication: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly pendingApplicationsSummary: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly newBountySubmitted: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly newMessageFromPartner: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly fraudEventsSummary: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + }; + readonly relations: { + readonly projectUser: { + readonly to: 'ProjectUsers'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectUserId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'NotificationPreference'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly projectUserId: { readonly column: 'projectUserId' }; + readonly linkUsageSummary: { readonly column: 'linkUsageSummary' }; + readonly domainConfigurationUpdates: { readonly column: 'domainConfigurationUpdates' }; + readonly newPartnerSale: { readonly column: 'newPartnerSale' }; + readonly newPartnerApplication: { readonly column: 'newPartnerApplication' }; + readonly pendingApplicationsSummary: { readonly column: 'pendingApplicationsSummary' }; + readonly newBountySubmitted: { readonly column: 'newBountySubmitted' }; + readonly newMessageFromPartner: { readonly column: 'newMessageFromPartner' }; + readonly fraudEventsSummary: { readonly column: 'fraudEventsSummary' }; + }; + }; + }; + readonly OAuthApp: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly integrationId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly clientId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly hashedClientSecret: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partialClientSecret: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly redirectUris: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly pkce: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + }; + readonly relations: { + readonly integration: { + readonly to: 'Integration'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['integrationId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly oAuthCodes: { + readonly to: 'OAuthCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['clientId']; + readonly targetFields: readonly ['clientId']; + }; + }; + }; + readonly storage: { + readonly table: 'OAuthApp'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly integrationId: { readonly column: 'integrationId' }; + readonly clientId: { readonly column: 'clientId' }; + readonly hashedClientSecret: { readonly column: 'hashedClientSecret' }; + readonly partialClientSecret: { readonly column: 'partialClientSecret' }; + readonly redirectUris: { readonly column: 'redirectUris' }; + readonly pkce: { readonly column: 'pkce' }; + }; + }; + }; + readonly OAuthCode: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly clientId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly code: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly scopes: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly redirectUri: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly codeChallenge: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly codeChallengeMethod: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expiresAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly oAuthApp: { + readonly to: 'OAuthApp'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['clientId']; + readonly targetFields: readonly ['clientId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'OAuthCode'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly clientId: { readonly column: 'clientId' }; + readonly userId: { readonly column: 'userId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly code: { readonly column: 'code' }; + readonly scopes: { readonly column: 'scopes' }; + readonly redirectUri: { readonly column: 'redirectUri' }; + readonly codeChallenge: { readonly column: 'codeChallenge' }; + readonly codeChallengeMethod: { readonly column: 'codeChallengeMethod' }; + readonly expiresAt: { readonly column: 'expiresAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly OAuthRefreshToken: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly installationId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly accessTokenId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly hashedRefreshToken: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expiresAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly accessToken: { + readonly to: 'RestrictedToken'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['accessTokenId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly installedIntegration: { + readonly to: 'InstalledIntegration'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['installationId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'OAuthRefreshToken'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly installationId: { readonly column: 'installationId' }; + readonly accessTokenId: { readonly column: 'accessTokenId' }; + readonly hashedRefreshToken: { readonly column: 'hashedRefreshToken' }; + readonly expiresAt: { readonly column: 'expiresAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly Partner: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly username: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly companyName: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly profileType: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly email: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly image: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly country: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly identityVerificationStatus: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly identityVerifiedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly veriffSessionId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly veriffMetadata: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly defaultPayoutMethod: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly payoutsEnabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly connectPayoutsLastRemindedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly paypalEmail: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripeConnectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripeRecipientId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly payoutMethodHash: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly cryptoWalletAddress: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly discoverableAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly trustedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly invoiceSettings: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly changeHistoryLog: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly referredByPartnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly monthlyTraffic: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + }; + readonly relations: { + readonly bountySubmissions: { + readonly to: 'BountySubmission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly comments: { + readonly to: 'PartnerComment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly customers: { + readonly to: 'Customer'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly discountCodes: { + readonly to: 'DiscountCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly discoveredByPrograms: { + readonly to: 'DiscoveredPartner'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly fraudAlerts: { + readonly to: 'FraudAlert'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly fraudEventGroups: { + readonly to: 'FraudEventGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly fraudEvents: { + readonly to: 'FraudEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly industryInterests: { + readonly to: 'PartnerIndustryInterest'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly invites: { + readonly to: 'PartnerInvite'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly messages: { + readonly to: 'Message'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly notificationEmails: { + readonly to: 'NotificationEmail'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly partnerRewinds: { + readonly to: 'PartnerRewind'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly payouts: { + readonly to: 'Payout'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly platforms: { + readonly to: 'PartnerPlatform'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly postbacks: { + readonly to: 'Postback'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly preferredEarningStructures: { + readonly to: 'PartnerPreferredEarningStructure'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly programs: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly referrals: { + readonly to: 'PartnerReferral'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly referredApplications: { + readonly to: 'ProgramApplicationEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['referredByPartnerId']; + }; + }; + readonly salesChannels: { + readonly to: 'PartnerSalesChannel'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + readonly sentMessages: { + readonly to: 'Message'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['senderPartnerId']; + }; + }; + readonly users: { + readonly to: 'PartnerUser'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerId']; + }; + }; + }; + readonly storage: { + readonly table: 'Partner'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly username: { readonly column: 'username' }; + readonly companyName: { readonly column: 'companyName' }; + readonly profileType: { readonly column: 'profileType' }; + readonly email: { readonly column: 'email' }; + readonly image: { readonly column: 'image' }; + readonly description: { readonly column: 'description' }; + readonly country: { readonly column: 'country' }; + readonly identityVerificationStatus: { readonly column: 'identityVerificationStatus' }; + readonly identityVerifiedAt: { readonly column: 'identityVerifiedAt' }; + readonly veriffSessionId: { readonly column: 'veriffSessionId' }; + readonly veriffMetadata: { readonly column: 'veriffMetadata' }; + readonly defaultPayoutMethod: { readonly column: 'defaultPayoutMethod' }; + readonly payoutsEnabledAt: { readonly column: 'payoutsEnabledAt' }; + readonly connectPayoutsLastRemindedAt: { + readonly column: 'connectPayoutsLastRemindedAt'; + }; + readonly paypalEmail: { readonly column: 'paypalEmail' }; + readonly stripeConnectId: { readonly column: 'stripeConnectId' }; + readonly stripeRecipientId: { readonly column: 'stripeRecipientId' }; + readonly payoutMethodHash: { readonly column: 'payoutMethodHash' }; + readonly cryptoWalletAddress: { readonly column: 'cryptoWalletAddress' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly discoverableAt: { readonly column: 'discoverableAt' }; + readonly trustedAt: { readonly column: 'trustedAt' }; + readonly invoiceSettings: { readonly column: 'invoiceSettings' }; + readonly changeHistoryLog: { readonly column: 'changeHistoryLog' }; + readonly referredByPartnerId: { readonly column: 'referredByPartnerId' }; + readonly monthlyTraffic: { readonly column: 'monthlyTraffic' }; + }; + }; + }; + readonly PartnerComment: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly text: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerComment'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly userId: { readonly column: 'userId' }; + readonly text: { readonly column: 'text' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly PartnerGroup: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly color: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly clickRewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly leadRewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly saleRewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly discountId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkStructure: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly additionalLinks: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly maxPartnerLinks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly applicationFormData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly applicationFormPublishedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly landerData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly landerPublishedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly logo: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly wordmark: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly brandColor: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly holdingPeriodDays: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly autoApprovePartnersEnabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly workflowId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utmTemplateId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly applications: { + readonly to: 'ProgramApplication'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['groupId']; + }; + }; + readonly bounties: { + readonly to: 'BountyGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['groupId']; + }; + }; + readonly campaigns: { + readonly to: 'CampaignGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['groupId']; + }; + }; + readonly clickReward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['clickRewardId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly discount: { + readonly to: 'Discount'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['discountId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly leadReward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['leadRewardId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partnerGroupDefaultLinks: { + readonly to: 'PartnerGroupDefaultLink'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['groupId']; + }; + }; + readonly partners: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['groupId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly saleReward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['saleRewardId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly utmTemplate: { + readonly to: 'UtmTemplate'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['utmTemplateId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly workflow: { + readonly to: 'Workflow'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['workflowId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerGroup'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly name: { readonly column: 'name' }; + readonly slug: { readonly column: 'slug' }; + readonly color: { readonly column: 'color' }; + readonly clickRewardId: { readonly column: 'clickRewardId' }; + readonly leadRewardId: { readonly column: 'leadRewardId' }; + readonly saleRewardId: { readonly column: 'saleRewardId' }; + readonly discountId: { readonly column: 'discountId' }; + readonly linkStructure: { readonly column: 'linkStructure' }; + readonly additionalLinks: { readonly column: 'additionalLinks' }; + readonly maxPartnerLinks: { readonly column: 'maxPartnerLinks' }; + readonly applicationFormData: { readonly column: 'applicationFormData' }; + readonly applicationFormPublishedAt: { readonly column: 'applicationFormPublishedAt' }; + readonly landerData: { readonly column: 'landerData' }; + readonly landerPublishedAt: { readonly column: 'landerPublishedAt' }; + readonly logo: { readonly column: 'logo' }; + readonly wordmark: { readonly column: 'wordmark' }; + readonly brandColor: { readonly column: 'brandColor' }; + readonly holdingPeriodDays: { readonly column: 'holdingPeriodDays' }; + readonly autoApprovePartnersEnabledAt: { + readonly column: 'autoApprovePartnersEnabledAt'; + }; + readonly workflowId: { readonly column: 'workflowId' }; + readonly utmTemplateId: { readonly column: 'utmTemplateId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly PartnerGroupDefaultLink: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly groupId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly domain: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly url: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['partnerGroupDefaultLinkId']; + }; + }; + readonly partnerGroup: { + readonly to: 'PartnerGroup'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['groupId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerGroupDefaultLink'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly groupId: { readonly column: 'groupId' }; + readonly domain: { readonly column: 'domain' }; + readonly url: { readonly column: 'url' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly PartnerIndustryInterest: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly industryInterest: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerIndustryInterest'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly industryInterest: { readonly column: 'industryInterest' }; + }; + }; + }; + readonly PartnerInvite: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly email: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly role: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerInvite'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly email: { readonly column: 'email' }; + readonly expires: { readonly column: 'expires' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly role: { readonly column: 'role' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly PartnerNotificationPreferences: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerUserId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly commissionCreated: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly applicationApproved: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly newMessageFromProgram: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly marketingCampaign: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly connectPayoutReminder: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly monthlyProgramSummary: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + }; + readonly relations: { + readonly partnerUser: { + readonly to: 'PartnerUser'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerUserId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerNotificationPreferences'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerUserId: { readonly column: 'partnerUserId' }; + readonly commissionCreated: { readonly column: 'commissionCreated' }; + readonly applicationApproved: { readonly column: 'applicationApproved' }; + readonly newMessageFromProgram: { readonly column: 'newMessageFromProgram' }; + readonly marketingCampaign: { readonly column: 'marketingCampaign' }; + readonly connectPayoutReminder: { readonly column: 'connectPayoutReminder' }; + readonly monthlyProgramSummary: { readonly column: 'monthlyProgramSummary' }; + }; + }; + }; + readonly PartnerPlatform: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly identifier: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly platformId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly avatarUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly subscribers: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly posts: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly views: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly metadata: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly verifiedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly lastCheckedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerPlatform'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly type: { readonly column: 'type' }; + readonly identifier: { readonly column: 'identifier' }; + readonly platformId: { readonly column: 'platformId' }; + readonly avatarUrl: { readonly column: 'avatarUrl' }; + readonly subscribers: { readonly column: 'subscribers' }; + readonly posts: { readonly column: 'posts' }; + readonly views: { readonly column: 'views' }; + readonly metadata: { readonly column: 'metadata' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly verifiedAt: { readonly column: 'verifiedAt' }; + readonly lastCheckedAt: { readonly column: 'lastCheckedAt' }; + }; + }; + }; + readonly PartnerPreferredEarningStructure: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly preferredEarningStructure: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerPreferredEarningStructure'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly preferredEarningStructure: { readonly column: 'preferredEarningStructure' }; + }; + }; + }; + readonly PartnerReferral: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly customerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly email: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly company: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly formData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly customer: { + readonly to: 'Customer'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['customerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerReferral'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly customerId: { readonly column: 'customerId' }; + readonly name: { readonly column: 'name' }; + readonly email: { readonly column: 'email' }; + readonly company: { readonly column: 'company' }; + readonly formData: { readonly column: 'formData' }; + readonly status: { readonly column: 'status' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly PartnerRewind: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly year: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalClicks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalLeads: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalRevenue: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalEarnings: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly sentAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerRewind'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly year: { readonly column: 'year' }; + readonly totalClicks: { readonly column: 'totalClicks' }; + readonly totalLeads: { readonly column: 'totalLeads' }; + readonly totalRevenue: { readonly column: 'totalRevenue' }; + readonly totalEarnings: { readonly column: 'totalEarnings' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly sentAt: { readonly column: 'sentAt' }; + }; + }; + }; + readonly PartnerSalesChannel: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly salesChannel: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerSalesChannel'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly salesChannel: { readonly column: 'salesChannel' }; + }; + }; + }; + readonly PartnerUser: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly role: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'PartnerUser'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly role: { readonly column: 'role' }; + readonly userId: { readonly column: 'userId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly PasswordResetToken: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly identifier: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly token: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: Record; + readonly storage: { + readonly table: 'PasswordResetToken'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly identifier: { readonly column: 'identifier' }; + readonly token: { readonly column: 'token' }; + readonly expires: { readonly column: 'expires' }; + }; + }; + }; + readonly Payout: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly invoiceId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly amount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly currency: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly mode: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly method: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly periodStart: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly periodEnd: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly paypalTransferId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripeTransferId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripePayoutId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripePayoutTraceId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly failureReason: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly webhookEventId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly initiatedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly paidAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['payoutId']; + }; + }; + readonly invoice: { + readonly to: 'Invoice'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['invoiceId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programEnrollment: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Payout'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly invoiceId: { readonly column: 'invoiceId' }; + readonly amount: { readonly column: 'amount' }; + readonly currency: { readonly column: 'currency' }; + readonly status: { readonly column: 'status' }; + readonly mode: { readonly column: 'mode' }; + readonly method: { readonly column: 'method' }; + readonly description: { readonly column: 'description' }; + readonly periodStart: { readonly column: 'periodStart' }; + readonly periodEnd: { readonly column: 'periodEnd' }; + readonly paypalTransferId: { readonly column: 'paypalTransferId' }; + readonly stripeTransferId: { readonly column: 'stripeTransferId' }; + readonly stripePayoutId: { readonly column: 'stripePayoutId' }; + readonly stripePayoutTraceId: { readonly column: 'stripePayoutTraceId' }; + readonly failureReason: { readonly column: 'failureReason' }; + readonly webhookEventId: { readonly column: 'webhookEventId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly userId: { readonly column: 'userId' }; + readonly initiatedAt: { readonly column: 'initiatedAt' }; + readonly paidAt: { readonly column: 'paidAt' }; + }; + }; + }; + readonly Postback: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly url: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly secret: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly triggers: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly receiver: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly disabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Postback'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly name: { readonly column: 'name' }; + readonly url: { readonly column: 'url' }; + readonly secret: { readonly column: 'secret' }; + readonly triggers: { readonly column: 'triggers' }; + readonly receiver: { readonly column: 'receiver' }; + readonly disabledAt: { readonly column: 'disabledAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Program: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly workspaceId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly defaultFolderId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly defaultGroupId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly domain: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly url: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly logo: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly primaryRewardEvent: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly minPayoutAmount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly payoutMode: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly inviteEmailData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly embedData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly resources: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly referralFormData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly applicationRequirements: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly termsUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly helpUrl: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly supportEmail: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly messagingEnabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly partnerNetworkEnabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly startedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly deactivatedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly addedToMarketplaceAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly featuredOnMarketplaceAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly marketplaceHeaderImage: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly marketplaceRanking: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + }; + readonly relations: { + readonly applications: { + readonly to: 'ProgramApplication'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly bounties: { + readonly to: 'Bounty'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly bountySubmissions: { + readonly to: 'BountySubmission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly campaigns: { + readonly to: 'Campaign'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly categories: { + readonly to: 'ProgramCategory'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly comments: { + readonly to: 'PartnerComment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly customDomain: { + readonly to: 'Domain'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['domain']; + readonly targetFields: readonly ['slug']; + }; + }; + readonly customers: { + readonly to: 'Customer'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly discountCodes: { + readonly to: 'DiscountCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly discounts: { + readonly to: 'Discount'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly discoveredPartners: { + readonly to: 'DiscoveredPartner'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly emailDomains: { + readonly to: 'EmailDomain'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly fraudAlerts: { + readonly to: 'FraudAlert'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly fraudEventGroups: { + readonly to: 'FraudEventGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly fraudRules: { + readonly to: 'FraudRule'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly groups: { + readonly to: 'PartnerGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly invoices: { + readonly to: 'Invoice'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly messages: { + readonly to: 'Message'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly partnerGroupDefaultLinks: { + readonly to: 'PartnerGroupDefaultLink'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly partners: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly payouts: { + readonly to: 'Payout'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly referrals: { + readonly to: 'PartnerReferral'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly rewards: { + readonly to: 'Reward'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly similarPrograms: { + readonly to: 'ProgramSimilarity'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly similarToPrograms: { + readonly to: 'ProgramSimilarity'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['similarProgramId']; + }; + }; + readonly sourceFraudEvents: { + readonly to: 'FraudEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['sourceProgramId']; + }; + }; + readonly workflows: { + readonly to: 'Workflow'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programId']; + }; + }; + readonly workspace: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['workspaceId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Program'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly workspaceId: { readonly column: 'workspaceId' }; + readonly defaultFolderId: { readonly column: 'defaultFolderId' }; + readonly defaultGroupId: { readonly column: 'defaultGroupId' }; + readonly name: { readonly column: 'name' }; + readonly slug: { readonly column: 'slug' }; + readonly domain: { readonly column: 'domain' }; + readonly url: { readonly column: 'url' }; + readonly logo: { readonly column: 'logo' }; + readonly description: { readonly column: 'description' }; + readonly primaryRewardEvent: { readonly column: 'primaryRewardEvent' }; + readonly minPayoutAmount: { readonly column: 'minPayoutAmount' }; + readonly payoutMode: { readonly column: 'payoutMode' }; + readonly inviteEmailData: { readonly column: 'inviteEmailData' }; + readonly embedData: { readonly column: 'embedData' }; + readonly resources: { readonly column: 'resources' }; + readonly referralFormData: { readonly column: 'referralFormData' }; + readonly applicationRequirements: { readonly column: 'applicationRequirements' }; + readonly termsUrl: { readonly column: 'termsUrl' }; + readonly helpUrl: { readonly column: 'helpUrl' }; + readonly supportEmail: { readonly column: 'supportEmail' }; + readonly messagingEnabledAt: { readonly column: 'messagingEnabledAt' }; + readonly partnerNetworkEnabledAt: { readonly column: 'partnerNetworkEnabledAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly startedAt: { readonly column: 'startedAt' }; + readonly deactivatedAt: { readonly column: 'deactivatedAt' }; + readonly addedToMarketplaceAt: { readonly column: 'addedToMarketplaceAt' }; + readonly featuredOnMarketplaceAt: { readonly column: 'featuredOnMarketplaceAt' }; + readonly marketplaceHeaderImage: { readonly column: 'marketplaceHeaderImage' }; + readonly marketplaceRanking: { readonly column: 'marketplaceRanking' }; + }; + }; + }; + readonly ProgramApplication: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly groupId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly email: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly country: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly website: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly youtube: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly twitter: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly linkedin: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly instagram: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly tiktok: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly formData: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly rejectionReason: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly rejectionNote: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly reviewedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly partnerGroup: { + readonly to: 'PartnerGroup'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['groupId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly programApplicationEvents: { + readonly to: 'ProgramApplicationEvent'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['programApplicationId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProgramApplication'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly groupId: { readonly column: 'groupId' }; + readonly name: { readonly column: 'name' }; + readonly email: { readonly column: 'email' }; + readonly country: { readonly column: 'country' }; + readonly website: { readonly column: 'website' }; + readonly youtube: { readonly column: 'youtube' }; + readonly twitter: { readonly column: 'twitter' }; + readonly linkedin: { readonly column: 'linkedin' }; + readonly instagram: { readonly column: 'instagram' }; + readonly tiktok: { readonly column: 'tiktok' }; + readonly formData: { readonly column: 'formData' }; + readonly userId: { readonly column: 'userId' }; + readonly rejectionReason: { readonly column: 'rejectionReason' }; + readonly rejectionNote: { readonly column: 'rejectionNote' }; + readonly reviewedAt: { readonly column: 'reviewedAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly ProgramApplicationEvent: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly visitedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly startedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly submittedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly approvedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly rejectedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly country: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly referralSource: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly referredByPartnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly metadata: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly programApplicationId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly application: { + readonly to: 'ProgramApplication'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programApplicationId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly referredByPartner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['referredByPartnerId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProgramApplicationEvent'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly visitedAt: { readonly column: 'visitedAt' }; + readonly startedAt: { readonly column: 'startedAt' }; + readonly submittedAt: { readonly column: 'submittedAt' }; + readonly approvedAt: { readonly column: 'approvedAt' }; + readonly rejectedAt: { readonly column: 'rejectedAt' }; + readonly country: { readonly column: 'country' }; + readonly referralSource: { readonly column: 'referralSource' }; + readonly referredByPartnerId: { readonly column: 'referredByPartnerId' }; + readonly metadata: { readonly column: 'metadata' }; + readonly programApplicationId: { readonly column: 'programApplicationId' }; + readonly partnerId: { readonly column: 'partnerId' }; + }; + }; + }; + readonly ProgramCategory: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly category: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + }; + readonly relations: { + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProgramCategory'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly category: { readonly column: 'category' }; + }; + }; + }; + readonly ProgramEnrollment: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly partnerId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly tenantId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly groupId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly applicationId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly clickRewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly leadRewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly saleRewardId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly discountId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly status: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly totalClicks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalLeads: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalConversions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalSales: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalSaleAmount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly totalCommissions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly netRevenue: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int8@1' }; + }; + readonly earningsPerClick: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly averageLifetimeValue: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly clickToLeadRate: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly clickToConversionRate: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly leadToConversionRate: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly returnOnAdSpend: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly lastConversionAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly daysSinceLastConversion: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly consistencyScore: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly customerDataSharingEnabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly groupMoveDisabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly bannedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly bannedReason: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + }; + readonly relations: { + readonly application: { + readonly to: 'ProgramApplication'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['applicationId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly bountySubmissions: { + readonly to: 'BountySubmission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly clickReward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['clickRewardId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly customers: { + readonly to: 'Customer'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly discount: { + readonly to: 'Discount'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['discountId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly discountCodes: { + readonly to: 'DiscountCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly fraudAlerts: { + readonly to: 'FraudAlert'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly fraudEventGroups: { + readonly to: 'FraudEventGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly leadReward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['leadRewardId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly messages: { + readonly to: 'Message'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly partner: { + readonly to: 'Partner'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['partnerId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly partnerGroup: { + readonly to: 'PartnerGroup'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['groupId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly payouts: { + readonly to: 'Payout'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly referrals: { + readonly to: 'PartnerReferral'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['programId', 'partnerId']; + readonly targetFields: readonly ['programId', 'partnerId']; + }; + }; + readonly saleReward: { + readonly to: 'Reward'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['saleRewardId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProgramEnrollment'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly partnerId: { readonly column: 'partnerId' }; + readonly programId: { readonly column: 'programId' }; + readonly tenantId: { readonly column: 'tenantId' }; + readonly groupId: { readonly column: 'groupId' }; + readonly applicationId: { readonly column: 'applicationId' }; + readonly clickRewardId: { readonly column: 'clickRewardId' }; + readonly leadRewardId: { readonly column: 'leadRewardId' }; + readonly saleRewardId: { readonly column: 'saleRewardId' }; + readonly discountId: { readonly column: 'discountId' }; + readonly status: { readonly column: 'status' }; + readonly totalClicks: { readonly column: 'totalClicks' }; + readonly totalLeads: { readonly column: 'totalLeads' }; + readonly totalConversions: { readonly column: 'totalConversions' }; + readonly totalSales: { readonly column: 'totalSales' }; + readonly totalSaleAmount: { readonly column: 'totalSaleAmount' }; + readonly totalCommissions: { readonly column: 'totalCommissions' }; + readonly netRevenue: { readonly column: 'netRevenue' }; + readonly earningsPerClick: { readonly column: 'earningsPerClick' }; + readonly averageLifetimeValue: { readonly column: 'averageLifetimeValue' }; + readonly clickToLeadRate: { readonly column: 'clickToLeadRate' }; + readonly clickToConversionRate: { readonly column: 'clickToConversionRate' }; + readonly leadToConversionRate: { readonly column: 'leadToConversionRate' }; + readonly returnOnAdSpend: { readonly column: 'returnOnAdSpend' }; + readonly lastConversionAt: { readonly column: 'lastConversionAt' }; + readonly daysSinceLastConversion: { readonly column: 'daysSinceLastConversion' }; + readonly consistencyScore: { readonly column: 'consistencyScore' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly customerDataSharingEnabledAt: { + readonly column: 'customerDataSharingEnabledAt'; + }; + readonly groupMoveDisabledAt: { readonly column: 'groupMoveDisabledAt' }; + readonly bannedAt: { readonly column: 'bannedAt' }; + readonly bannedReason: { readonly column: 'bannedReason' }; + }; + }; + }; + readonly ProgramSimilarity: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly similarProgramId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly similarityScore: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly categorySimilarityScore: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly partnerSimilarityScore: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly performanceSimilarityScore: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + }; + readonly relations: { + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly similarProgram: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['similarProgramId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProgramSimilarity'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly similarProgramId: { readonly column: 'similarProgramId' }; + readonly similarityScore: { readonly column: 'similarityScore' }; + readonly categorySimilarityScore: { readonly column: 'categorySimilarityScore' }; + readonly partnerSimilarityScore: { readonly column: 'partnerSimilarityScore' }; + readonly performanceSimilarityScore: { readonly column: 'performanceSimilarityScore' }; + }; + }; + }; + readonly Project: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly logo: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly inviteCode: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly defaultProgramId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly plan: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly planTier: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly planPeriod: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly stripeId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly billingCycleStart: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly billingCycleEndsAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly trialEndsAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly subscriptionCanceledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly paymentFailedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly invoicePrefix: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly stripeConnectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly shopifyStoreId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly totalLinks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalClicks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly usage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly usageLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly linksUsage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly linksLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly payoutsUsage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly payoutsLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly payoutFee: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/float8@1' }; + }; + readonly payoutFeeWaiverLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly payoutFeeWaiverUsage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly domainsLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly tagsLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly foldersUsage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly foldersLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly partnersUsage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly partnersLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly groupsLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly usersLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly aiUsage: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly aiLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly networkInvitesLimit: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly referralLinkId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly referredSignups: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly store: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly siteVisitTrackingSettings: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly allowedHostnames: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly publishableKey: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly conversionEnabled: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly webhookEnabled: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly dotLinkClaimed: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly fastDirectDebitPayouts: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly ssoEmailDomain: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly ssoEnforcedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly usageLastChecked: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly customers: { + readonly to: 'Customer'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly dashboards: { + readonly to: 'Dashboard'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly defaultDomains: { + readonly to: 'DefaultDomains'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly domains: { + readonly to: 'Domain'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly folders: { + readonly to: 'Folder'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly installedIntegrations: { + readonly to: 'InstalledIntegration'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly integrations: { + readonly to: 'Integration'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly invites: { + readonly to: 'ProjectInvite'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly invoices: { + readonly to: 'Invoice'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['workspaceId']; + }; + }; + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly oAuthCodes: { + readonly to: 'OAuthCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly programs: { + readonly to: 'Program'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['workspaceId']; + }; + }; + readonly registeredDomains: { + readonly to: 'RegisteredDomain'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly restrictedTokens: { + readonly to: 'RestrictedToken'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly sentEmails: { + readonly to: 'SentEmail'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly tags: { + readonly to: 'Tag'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly users: { + readonly to: 'ProjectUsers'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly utmTemplates: { + readonly to: 'UtmTemplate'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly webhooks: { + readonly to: 'Webhook'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['projectId']; + }; + }; + readonly yearInReviews: { + readonly to: 'YearInReview'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['workspaceId']; + }; + }; + }; + readonly storage: { + readonly table: 'Project'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly slug: { readonly column: 'slug' }; + readonly logo: { readonly column: 'logo' }; + readonly inviteCode: { readonly column: 'inviteCode' }; + readonly defaultProgramId: { readonly column: 'defaultProgramId' }; + readonly plan: { readonly column: 'plan' }; + readonly planTier: { readonly column: 'planTier' }; + readonly planPeriod: { readonly column: 'planPeriod' }; + readonly stripeId: { readonly column: 'stripeId' }; + readonly billingCycleStart: { readonly column: 'billingCycleStart' }; + readonly billingCycleEndsAt: { readonly column: 'billingCycleEndsAt' }; + readonly trialEndsAt: { readonly column: 'trialEndsAt' }; + readonly subscriptionCanceledAt: { readonly column: 'subscriptionCanceledAt' }; + readonly paymentFailedAt: { readonly column: 'paymentFailedAt' }; + readonly invoicePrefix: { readonly column: 'invoicePrefix' }; + readonly stripeConnectId: { readonly column: 'stripeConnectId' }; + readonly shopifyStoreId: { readonly column: 'shopifyStoreId' }; + readonly totalLinks: { readonly column: 'totalLinks' }; + readonly totalClicks: { readonly column: 'totalClicks' }; + readonly usage: { readonly column: 'usage' }; + readonly usageLimit: { readonly column: 'usageLimit' }; + readonly linksUsage: { readonly column: 'linksUsage' }; + readonly linksLimit: { readonly column: 'linksLimit' }; + readonly payoutsUsage: { readonly column: 'payoutsUsage' }; + readonly payoutsLimit: { readonly column: 'payoutsLimit' }; + readonly payoutFee: { readonly column: 'payoutFee' }; + readonly payoutFeeWaiverLimit: { readonly column: 'payoutFeeWaiverLimit' }; + readonly payoutFeeWaiverUsage: { readonly column: 'payoutFeeWaiverUsage' }; + readonly domainsLimit: { readonly column: 'domainsLimit' }; + readonly tagsLimit: { readonly column: 'tagsLimit' }; + readonly foldersUsage: { readonly column: 'foldersUsage' }; + readonly foldersLimit: { readonly column: 'foldersLimit' }; + readonly partnersUsage: { readonly column: 'partnersUsage' }; + readonly partnersLimit: { readonly column: 'partnersLimit' }; + readonly groupsLimit: { readonly column: 'groupsLimit' }; + readonly usersLimit: { readonly column: 'usersLimit' }; + readonly aiUsage: { readonly column: 'aiUsage' }; + readonly aiLimit: { readonly column: 'aiLimit' }; + readonly networkInvitesLimit: { readonly column: 'networkInvitesLimit' }; + readonly referralLinkId: { readonly column: 'referralLinkId' }; + readonly referredSignups: { readonly column: 'referredSignups' }; + readonly store: { readonly column: 'store' }; + readonly siteVisitTrackingSettings: { readonly column: 'siteVisitTrackingSettings' }; + readonly allowedHostnames: { readonly column: 'allowedHostnames' }; + readonly publishableKey: { readonly column: 'publishableKey' }; + readonly conversionEnabled: { readonly column: 'conversionEnabled' }; + readonly webhookEnabled: { readonly column: 'webhookEnabled' }; + readonly dotLinkClaimed: { readonly column: 'dotLinkClaimed' }; + readonly fastDirectDebitPayouts: { readonly column: 'fastDirectDebitPayouts' }; + readonly ssoEmailDomain: { readonly column: 'ssoEmailDomain' }; + readonly ssoEnforcedAt: { readonly column: 'ssoEnforcedAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly usageLastChecked: { readonly column: 'usageLastChecked' }; + }; + }; + }; + readonly ProjectInvite: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly email: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly role: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProjectInvite'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly email: { readonly column: 'email' }; + readonly expires: { readonly column: 'expires' }; + readonly projectId: { readonly column: 'projectId' }; + readonly role: { readonly column: 'role' }; + readonly createdAt: { readonly column: 'createdAt' }; + }; + }; + }; + readonly ProjectUsers: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly role: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly workspacePreferences: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly defaultFolderId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'ProjectUsers'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly role: { readonly column: 'role' }; + readonly userId: { readonly column: 'userId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly workspacePreferences: { readonly column: 'workspacePreferences' }; + readonly defaultFolderId: { readonly column: 'defaultFolderId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly RegisteredDomain: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly slug: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly domainId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly autoRenewalDisabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly renewalFee: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly expiresAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly domain: { + readonly to: 'Domain'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['domainId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'RegisteredDomain'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly slug: { readonly column: 'slug' }; + readonly projectId: { readonly column: 'projectId' }; + readonly domainId: { readonly column: 'domainId' }; + readonly autoRenewalDisabledAt: { readonly column: 'autoRenewalDisabledAt' }; + readonly renewalFee: { readonly column: 'renewalFee' }; + readonly expiresAt: { readonly column: 'expiresAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly RestrictedToken: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly hashedKey: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partialKey: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly scopes: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly lastUsed: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly installationId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly installedIntegration: { + readonly to: 'InstalledIntegration'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['installationId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly refreshTokens: { + readonly to: 'OAuthRefreshToken'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['accessTokenId']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'RestrictedToken'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly hashedKey: { readonly column: 'hashedKey' }; + readonly partialKey: { readonly column: 'partialKey' }; + readonly scopes: { readonly column: 'scopes' }; + readonly expires: { readonly column: 'expires' }; + readonly lastUsed: { readonly column: 'lastUsed' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly userId: { readonly column: 'userId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly installationId: { readonly column: 'installationId' }; + }; + }; + }; + readonly Reward: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly description: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly tooltipDescription: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly event: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly amountInCents: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly amountInPercentage: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/numeric@1' }; + }; + readonly maxDuration: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly modifiers: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/json@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly clickEnrollments: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['clickRewardId']; + }; + }; + readonly commissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['rewardId']; + }; + }; + readonly leadEnrollments: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['leadRewardId']; + }; + }; + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly saleEnrollments: { + readonly to: 'ProgramEnrollment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['saleRewardId']; + }; + }; + }; + readonly storage: { + readonly table: 'Reward'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly description: { readonly column: 'description' }; + readonly tooltipDescription: { readonly column: 'tooltipDescription' }; + readonly event: { readonly column: 'event' }; + readonly type: { readonly column: 'type' }; + readonly amountInCents: { readonly column: 'amountInCents' }; + readonly amountInPercentage: { readonly column: 'amountInPercentage' }; + readonly maxDuration: { readonly column: 'maxDuration' }; + readonly modifiers: { readonly column: 'modifiers' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly SentEmail: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly type: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly projectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'SentEmail'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly type: { readonly column: 'type' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly projectId: { readonly column: 'projectId' }; + }; + }; + }; + readonly Session: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly sessionToken: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Session'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly sessionToken: { readonly column: 'sessionToken' }; + readonly userId: { readonly column: 'userId' }; + readonly expires: { readonly column: 'expires' }; + }; + }; + }; + readonly Tag: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly color: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly links: { + readonly to: 'LinkTag'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['tagId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Tag'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly color: { readonly column: 'color' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly projectId: { readonly column: 'projectId' }; + }; + }; + }; + readonly Token: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly hashedKey: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly partialKey: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly lastUsed: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + }; + readonly relations: { + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Token'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly hashedKey: { readonly column: 'hashedKey' }; + readonly partialKey: { readonly column: 'partialKey' }; + readonly expires: { readonly column: 'expires' }; + readonly lastUsed: { readonly column: 'lastUsed' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + readonly userId: { readonly column: 'userId' }; + }; + }; + }; + readonly User: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly email: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly emailVerified: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly image: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly isMachine: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly passwordHash: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly invalidLoginAttempts: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly lockedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly defaultWorkspace: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly defaultPartnerId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly source: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly sentMail: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + }; + readonly relations: { + readonly accounts: { + readonly to: 'Account'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly activityLogs: { + readonly to: 'ActivityLog'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly bountySubmissions: { + readonly to: 'BountySubmission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly createdCommissions: { + readonly to: 'Commission'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly dashboards: { + readonly to: 'Dashboard'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly folderAccessRequests: { + readonly to: 'FolderAccessRequest'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly folders: { + readonly to: 'FolderUser'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly fraudAlertsReviewed: { + readonly to: 'FraudAlert'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['reviewedById']; + }; + }; + readonly fraudEventGroups: { + readonly to: 'FraudEventGroup'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly installedIntegrations: { + readonly to: 'InstalledIntegration'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly integrations: { + readonly to: 'Integration'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly links: { + readonly to: 'Link'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly oAuthCodes: { + readonly to: 'OAuthCode'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly partnerComments: { + readonly to: 'PartnerComment'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly partners: { + readonly to: 'PartnerUser'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly payouts: { + readonly to: 'Payout'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly programApplications: { + readonly to: 'ProgramApplication'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly projects: { + readonly to: 'ProjectUsers'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly restrictedTokens: { + readonly to: 'RestrictedToken'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly sentMessages: { + readonly to: 'Message'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['senderUserId']; + }; + }; + readonly sessions: { + readonly to: 'Session'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly tokens: { + readonly to: 'Token'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + readonly utmTemplates: { + readonly to: 'UtmTemplate'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['userId']; + }; + }; + }; + readonly storage: { + readonly table: 'User'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly email: { readonly column: 'email' }; + readonly emailVerified: { readonly column: 'emailVerified' }; + readonly image: { readonly column: 'image' }; + readonly isMachine: { readonly column: 'isMachine' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly passwordHash: { readonly column: 'passwordHash' }; + readonly invalidLoginAttempts: { readonly column: 'invalidLoginAttempts' }; + readonly lockedAt: { readonly column: 'lockedAt' }; + readonly defaultWorkspace: { readonly column: 'defaultWorkspace' }; + readonly defaultPartnerId: { readonly column: 'defaultPartnerId' }; + readonly source: { readonly column: 'source' }; + readonly sentMail: { readonly column: 'sentMail' }; + }; + }; + }; + readonly UserNotificationPreferences: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly userId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly dubLinks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly dubPartners: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + readonly partnerAccount: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/bool@1' }; + }; + }; + readonly relations: { + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'UserNotificationPreferences'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly userId: { readonly column: 'userId' }; + readonly dubLinks: { readonly column: 'dubLinks' }; + readonly dubPartners: { readonly column: 'dubPartners' }; + readonly partnerAccount: { readonly column: 'partnerAccount' }; + }; + }; + }; + readonly UtmTemplate: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_source: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_medium: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_campaign: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_term: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly utm_content: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly ref: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly userId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly projectId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly user: { + readonly to: 'User'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['userId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'UtmTemplate'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly name: { readonly column: 'name' }; + readonly utm_source: { readonly column: 'utm_source' }; + readonly utm_medium: { readonly column: 'utm_medium' }; + readonly utm_campaign: { readonly column: 'utm_campaign' }; + readonly utm_term: { readonly column: 'utm_term' }; + readonly utm_content: { readonly column: 'utm_content' }; + readonly ref: { readonly column: 'ref' }; + readonly userId: { readonly column: 'userId' }; + readonly projectId: { readonly column: 'projectId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly VerificationToken: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly identifier: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly token: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly expires: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: Record; + readonly storage: { + readonly table: 'VerificationToken'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly identifier: { readonly column: 'identifier' }; + readonly token: { readonly column: 'token' }; + readonly expires: { readonly column: 'expires' }; + }; + }; + }; + readonly Webhook: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly projectId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly installationId: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly receiver: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly name: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly url: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly secret: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly triggers: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly consecutiveFailures: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly lastFailedAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly disabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly installedIntegration: { + readonly to: 'InstalledIntegration'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['installationId']; + readonly targetFields: readonly ['id']; + }; + }; + readonly links: { + readonly to: 'LinkWebhook'; + readonly cardinality: '1:N'; + readonly on: { + readonly localFields: readonly ['id']; + readonly targetFields: readonly ['webhookId']; + }; + }; + readonly project: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['projectId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Webhook'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly projectId: { readonly column: 'projectId' }; + readonly installationId: { readonly column: 'installationId' }; + readonly receiver: { readonly column: 'receiver' }; + readonly name: { readonly column: 'name' }; + readonly url: { readonly column: 'url' }; + readonly secret: { readonly column: 'secret' }; + readonly triggers: { readonly column: 'triggers' }; + readonly consecutiveFailures: { readonly column: 'consecutiveFailures' }; + readonly lastFailedAt: { readonly column: 'lastFailedAt' }; + readonly disabledAt: { readonly column: 'disabledAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly Workflow: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly programId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly name: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly trigger: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/enum@1' }; + }; + readonly triggerConditions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly actions: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly disabledAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly updatedAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamptz@1' }; + }; + }; + readonly relations: { + readonly program: { + readonly to: 'Program'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['programId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'Workflow'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly programId: { readonly column: 'programId' }; + readonly name: { readonly column: 'name' }; + readonly trigger: { readonly column: 'trigger' }; + readonly triggerConditions: { readonly column: 'triggerConditions' }; + readonly actions: { readonly column: 'actions' }; + readonly disabledAt: { readonly column: 'disabledAt' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly updatedAt: { readonly column: 'updatedAt' }; + }; + }; + }; + readonly YearInReview: { + readonly fields: { + readonly id: { + readonly nullable: false; + readonly type: { + readonly kind: 'scalar'; + readonly codecId: 'sql/char@1'; + readonly typeParams: { readonly length: 24 }; + }; + }; + readonly year: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalLinks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly totalClicks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/int4@1' }; + }; + readonly topLinks: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly topCountries: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/jsonb@1' }; + }; + readonly workspaceId: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' }; + }; + readonly createdAt: { + readonly nullable: false; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + readonly sentAt: { + readonly nullable: true; + readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/timestamp@1' }; + }; + }; + readonly relations: { + readonly workspace: { + readonly to: 'Project'; + readonly cardinality: 'N:1'; + readonly on: { + readonly localFields: readonly ['workspaceId']; + readonly targetFields: readonly ['id']; + }; + }; + }; + readonly storage: { + readonly table: 'YearInReview'; + readonly fields: { + readonly id: { readonly column: 'id' }; + readonly year: { readonly column: 'year' }; + readonly totalLinks: { readonly column: 'totalLinks' }; + readonly totalClicks: { readonly column: 'totalClicks' }; + readonly topLinks: { readonly column: 'topLinks' }; + readonly topCountries: { readonly column: 'topCountries' }; + readonly workspaceId: { readonly column: 'workspaceId' }; + readonly createdAt: { readonly column: 'createdAt' }; + readonly sentAt: { readonly column: 'sentAt' }; + }; + }; + }; + } +> & { + readonly target: 'postgres'; + readonly targetFamily: 'sql'; + readonly roots: { + readonly User: 'User'; + readonly Account: 'Account'; + readonly Session: 'Session'; + readonly ActivityLog: 'ActivityLog'; + readonly ProgramApplication: 'ProgramApplication'; + readonly ProgramApplicationEvent: 'ProgramApplicationEvent'; + readonly Bounty: 'Bounty'; + readonly BountyGroup: 'BountyGroup'; + readonly BountySubmission: 'BountySubmission'; + readonly Campaign: 'Campaign'; + readonly CampaignGroup: 'CampaignGroup'; + readonly PartnerComment: 'PartnerComment'; + readonly Commission: 'Commission'; + readonly Customer: 'Customer'; + readonly Dashboard: 'Dashboard'; + readonly Discount: 'Discount'; + readonly DiscountCode: 'DiscountCode'; + readonly Domain: 'Domain'; + readonly RegisteredDomain: 'RegisteredDomain'; + readonly DefaultDomains: 'DefaultDomains'; + readonly EmailDomain: 'EmailDomain'; + readonly Folder: 'Folder'; + readonly FolderUser: 'FolderUser'; + readonly FolderAccessRequest: 'FolderAccessRequest'; + readonly FraudRule: 'FraudRule'; + readonly FraudEventGroup: 'FraudEventGroup'; + readonly FraudEvent: 'FraudEvent'; + readonly FraudAlert: 'FraudAlert'; + readonly PartnerGroup: 'PartnerGroup'; + readonly PartnerGroupDefaultLink: 'PartnerGroupDefaultLink'; + readonly Integration: 'Integration'; + readonly InstalledIntegration: 'InstalledIntegration'; + readonly Invoice: 'Invoice'; + readonly jackson_index: 'jackson_index'; + readonly jackson_store: 'jackson_store'; + readonly jackson_ttl: 'jackson_ttl'; + readonly Link: 'Link'; + readonly Message: 'Message'; + readonly YearInReview: 'YearInReview'; + readonly PartnerRewind: 'PartnerRewind'; + readonly ProgramCategory: 'ProgramCategory'; + readonly ProgramSimilarity: 'ProgramSimilarity'; + readonly DiscoveredPartner: 'DiscoveredPartner'; + readonly NotificationEmail: 'NotificationEmail'; + readonly UserNotificationPreferences: 'UserNotificationPreferences'; + readonly NotificationPreference: 'NotificationPreference'; + readonly PartnerNotificationPreferences: 'PartnerNotificationPreferences'; + readonly OAuthApp: 'OAuthApp'; + readonly OAuthCode: 'OAuthCode'; + readonly OAuthRefreshToken: 'OAuthRefreshToken'; + readonly Partner: 'Partner'; + readonly PartnerInvite: 'PartnerInvite'; + readonly PartnerUser: 'PartnerUser'; + readonly PartnerIndustryInterest: 'PartnerIndustryInterest'; + readonly PartnerPreferredEarningStructure: 'PartnerPreferredEarningStructure'; + readonly PartnerSalesChannel: 'PartnerSalesChannel'; + readonly Payout: 'Payout'; + readonly PartnerPlatform: 'PartnerPlatform'; + readonly Postback: 'Postback'; + readonly Program: 'Program'; + readonly ProgramEnrollment: 'ProgramEnrollment'; + readonly PartnerReferral: 'PartnerReferral'; + readonly Reward: 'Reward'; + readonly Tag: 'Tag'; + readonly LinkTag: 'LinkTag'; + readonly Token: 'Token'; + readonly RestrictedToken: 'RestrictedToken'; + readonly VerificationToken: 'VerificationToken'; + readonly EmailVerificationToken: 'EmailVerificationToken'; + readonly PasswordResetToken: 'PasswordResetToken'; + readonly UtmTemplate: 'UtmTemplate'; + readonly Webhook: 'Webhook'; + readonly LinkWebhook: 'LinkWebhook'; + readonly Workflow: 'Workflow'; + readonly Project: 'Project'; + readonly ProjectInvite: 'ProjectInvite'; + readonly ProjectUsers: 'ProjectUsers'; + readonly SentEmail: 'SentEmail'; + }; + readonly capabilities: { + readonly postgres: { + readonly jsonAgg: true; + readonly lateral: true; + readonly limit: true; + readonly orderBy: true; + readonly returning: true; + }; + readonly sql: { + readonly defaultInInsert: true; + readonly enums: true; + readonly returning: true; + }; + }; + readonly extensionPacks: {}; + readonly execution: { + readonly executionHash: ExecutionHash; + readonly mutations: { + readonly defaults: readonly [ + { + readonly ref: { readonly table: 'Account'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ActivityLog'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Bounty'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Bounty'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'BountyGroup'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'BountySubmission'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'BountySubmission'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Campaign'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Campaign'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'CampaignGroup'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Commission'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Commission'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Customer'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Customer'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Dashboard'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Dashboard'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'DefaultDomains'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Discount'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Discount'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'DiscountCode'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'DiscountCode'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'DiscoveredPartner'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'DiscoveredPartner'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Domain'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Domain'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'EmailDomain'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'EmailDomain'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'EmailVerificationToken'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Folder'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Folder'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'FolderAccessRequest'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'FolderUser'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'FolderUser'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'FraudAlert'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'FraudAlert'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'FraudEvent'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'FraudEvent'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'FraudEventGroup'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'FraudEventGroup'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'FraudRule'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'FraudRule'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'InstalledIntegration'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'InstalledIntegration'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Integration'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Integration'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Invoice'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Link'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Link'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'LinkTag'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'LinkTag'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'LinkWebhook'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Message'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Message'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'NotificationEmail'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'NotificationPreference'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'OAuthApp'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'OAuthCode'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'OAuthRefreshToken'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Partner'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Partner'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'PartnerComment'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerComment'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'PartnerGroup'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerGroup'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'PartnerGroupDefaultLink'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerGroupDefaultLink'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'PartnerIndustryInterest'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerInvite'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerNotificationPreferences'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerPlatform'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerPlatform'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { + readonly table: 'PartnerPreferredEarningStructure'; + readonly column: 'id'; + }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerReferral'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerReferral'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'PartnerRewind'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerSalesChannel'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerUser'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'PartnerUser'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'PasswordResetToken'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Payout'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Payout'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Postback'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Postback'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Program'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Program'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'ProgramApplication'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ProgramApplication'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'ProgramApplicationEvent'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ProgramCategory'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ProgramEnrollment'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ProgramEnrollment'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'ProgramSimilarity'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Project'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Project'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'ProjectInvite'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ProjectUsers'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'ProjectUsers'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'RegisteredDomain'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'RegisteredDomain'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'RestrictedToken'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'RestrictedToken'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Reward'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Reward'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'SentEmail'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Session'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Tag'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Tag'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Token'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Token'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'User'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'UserNotificationPreferences'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'UtmTemplate'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'UtmTemplate'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'VerificationToken'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Webhook'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Webhook'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'Workflow'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + { + readonly ref: { readonly table: 'Workflow'; readonly column: 'updatedAt' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + readonly onUpdate: { readonly kind: 'generator'; readonly id: 'timestampNow' }; + }, + { + readonly ref: { readonly table: 'YearInReview'; readonly column: 'id' }; + readonly onCreate: { readonly kind: 'generator'; readonly id: 'cuid2' }; + }, + ]; + }; + }; + readonly meta: {}; + + readonly profileHash: ProfileHash; +}; + +export type Contract = ContractWithTypeMaps; + +export type Tables = Contract['storage']['tables']; +export type Models = Contract['models']; diff --git a/packages/prisma/schema/contract.json b/packages/prisma/schema/contract.json new file mode 100644 index 00000000000..2ed8b090860 --- /dev/null +++ b/packages/prisma/schema/contract.json @@ -0,0 +1,26766 @@ +{ + "schemaVersion": "1", + "targetFamily": "sql", + "target": "postgres", + "profileHash": "sha256:1a8dbe044289f30a1de958fe800cc5a8378b285d2e126a8c44b58864bac2c18e", + "roots": { + "Account": "Account", + "ActivityLog": "ActivityLog", + "Bounty": "Bounty", + "BountyGroup": "BountyGroup", + "BountySubmission": "BountySubmission", + "Campaign": "Campaign", + "CampaignGroup": "CampaignGroup", + "Commission": "Commission", + "Customer": "Customer", + "Dashboard": "Dashboard", + "DefaultDomains": "DefaultDomains", + "Discount": "Discount", + "DiscountCode": "DiscountCode", + "DiscoveredPartner": "DiscoveredPartner", + "Domain": "Domain", + "EmailDomain": "EmailDomain", + "EmailVerificationToken": "EmailVerificationToken", + "Folder": "Folder", + "FolderAccessRequest": "FolderAccessRequest", + "FolderUser": "FolderUser", + "FraudAlert": "FraudAlert", + "FraudEvent": "FraudEvent", + "FraudEventGroup": "FraudEventGroup", + "FraudRule": "FraudRule", + "InstalledIntegration": "InstalledIntegration", + "Integration": "Integration", + "Invoice": "Invoice", + "Link": "Link", + "LinkTag": "LinkTag", + "LinkWebhook": "LinkWebhook", + "Message": "Message", + "NotificationEmail": "NotificationEmail", + "NotificationPreference": "NotificationPreference", + "OAuthApp": "OAuthApp", + "OAuthCode": "OAuthCode", + "OAuthRefreshToken": "OAuthRefreshToken", + "Partner": "Partner", + "PartnerComment": "PartnerComment", + "PartnerGroup": "PartnerGroup", + "PartnerGroupDefaultLink": "PartnerGroupDefaultLink", + "PartnerIndustryInterest": "PartnerIndustryInterest", + "PartnerInvite": "PartnerInvite", + "PartnerNotificationPreferences": "PartnerNotificationPreferences", + "PartnerPlatform": "PartnerPlatform", + "PartnerPreferredEarningStructure": "PartnerPreferredEarningStructure", + "PartnerReferral": "PartnerReferral", + "PartnerRewind": "PartnerRewind", + "PartnerSalesChannel": "PartnerSalesChannel", + "PartnerUser": "PartnerUser", + "PasswordResetToken": "PasswordResetToken", + "Payout": "Payout", + "Postback": "Postback", + "Program": "Program", + "ProgramApplication": "ProgramApplication", + "ProgramApplicationEvent": "ProgramApplicationEvent", + "ProgramCategory": "ProgramCategory", + "ProgramEnrollment": "ProgramEnrollment", + "ProgramSimilarity": "ProgramSimilarity", + "Project": "Project", + "ProjectInvite": "ProjectInvite", + "ProjectUsers": "ProjectUsers", + "RegisteredDomain": "RegisteredDomain", + "RestrictedToken": "RestrictedToken", + "Reward": "Reward", + "SentEmail": "SentEmail", + "Session": "Session", + "Tag": "Tag", + "Token": "Token", + "User": "User", + "UserNotificationPreferences": "UserNotificationPreferences", + "UtmTemplate": "UtmTemplate", + "VerificationToken": "VerificationToken", + "Webhook": "Webhook", + "Workflow": "Workflow", + "YearInReview": "YearInReview", + "jackson_index": "jackson_index", + "jackson_store": "jackson_store", + "jackson_ttl": "jackson_ttl" + }, + "models": { + "Account": { + "fields": { + "access_token": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "expires_at": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "id_token": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "provider": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "providerAccountId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "refresh_token": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "refresh_token_expires_in": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "scope": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "session_state": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "token_type": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "access_token": { + "column": "access_token" + }, + "expires_at": { + "column": "expires_at" + }, + "id": { + "column": "id" + }, + "id_token": { + "column": "id_token" + }, + "provider": { + "column": "provider" + }, + "providerAccountId": { + "column": "providerAccountId" + }, + "refresh_token": { + "column": "refresh_token" + }, + "refresh_token_expires_in": { + "column": "refresh_token_expires_in" + }, + "scope": { + "column": "scope" + }, + "session_state": { + "column": "session_state" + }, + "token_type": { + "column": "token_type" + }, + "type": { + "column": "type" + }, + "userId": { + "column": "userId" + } + }, + "table": "Account" + } + }, + "ActivityLog": { + "fields": { + "action": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "batchId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "changeSet": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "parentResourceId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "parentResourceType": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "resourceId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "resourceType": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "workspaceId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "action": { + "column": "action" + }, + "batchId": { + "column": "batchId" + }, + "changeSet": { + "column": "changeSet" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "id": { + "column": "id" + }, + "parentResourceId": { + "column": "parentResourceId" + }, + "parentResourceType": { + "column": "parentResourceType" + }, + "programId": { + "column": "programId" + }, + "resourceId": { + "column": "resourceId" + }, + "resourceType": { + "column": "resourceType" + }, + "userId": { + "column": "userId" + }, + "workspaceId": { + "column": "workspaceId" + } + }, + "table": "ActivityLog" + } + }, + "Bounty": { + "fields": { + "archivedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "endsAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "maxSubmissions": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "performanceScope": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "rewardAmount": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "rewardDescription": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "socialMetricsLastSyncedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "startsAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "submissionFrequency": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "submissionRequirements": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "submissionsOpenAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "workflowId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "emails": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "bountyId" + ] + }, + "to": "NotificationEmail" + }, + "groups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "bountyId" + ] + }, + "to": "BountyGroup" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "submissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "bountyId" + ] + }, + "to": "BountySubmission" + }, + "workflow": { + "cardinality": "N:1", + "on": { + "localFields": [ + "workflowId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Workflow" + } + }, + "storage": { + "fields": { + "archivedAt": { + "column": "archivedAt" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "endsAt": { + "column": "endsAt" + }, + "id": { + "column": "id" + }, + "maxSubmissions": { + "column": "maxSubmissions" + }, + "name": { + "column": "name" + }, + "performanceScope": { + "column": "performanceScope" + }, + "programId": { + "column": "programId" + }, + "rewardAmount": { + "column": "rewardAmount" + }, + "rewardDescription": { + "column": "rewardDescription" + }, + "socialMetricsLastSyncedAt": { + "column": "socialMetricsLastSyncedAt" + }, + "startsAt": { + "column": "startsAt" + }, + "submissionFrequency": { + "column": "submissionFrequency" + }, + "submissionRequirements": { + "column": "submissionRequirements" + }, + "submissionsOpenAt": { + "column": "submissionsOpenAt" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + }, + "workflowId": { + "column": "workflowId" + } + }, + "table": "Bounty" + } + }, + "BountyGroup": { + "fields": { + "bountyId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "groupId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + } + }, + "relations": { + "bounty": { + "cardinality": "N:1", + "on": { + "localFields": [ + "bountyId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Bounty" + }, + "partnerGroup": { + "cardinality": "N:1", + "on": { + "localFields": [ + "groupId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerGroup" + } + }, + "storage": { + "fields": { + "bountyId": { + "column": "bountyId" + }, + "groupId": { + "column": "groupId" + }, + "id": { + "column": "id" + } + }, + "table": "BountyGroup" + } + }, + "BountySubmission": { + "fields": { + "bountyId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "commissionId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "completedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "files": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "performanceCount": { + "nullable": true, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "periodNumber": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "rejectionNote": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "rejectionReason": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "reviewedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "socialMetricCount": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "socialMetricsLastSyncedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "urls": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "bounty": { + "cardinality": "N:1", + "on": { + "localFields": [ + "bountyId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Bounty" + }, + "commission": { + "cardinality": "N:1", + "on": { + "localFields": [ + "commissionId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Commission" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "bountyId": { + "column": "bountyId" + }, + "commissionId": { + "column": "commissionId" + }, + "completedAt": { + "column": "completedAt" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "files": { + "column": "files" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "performanceCount": { + "column": "performanceCount" + }, + "periodNumber": { + "column": "periodNumber" + }, + "programId": { + "column": "programId" + }, + "rejectionNote": { + "column": "rejectionNote" + }, + "rejectionReason": { + "column": "rejectionReason" + }, + "reviewedAt": { + "column": "reviewedAt" + }, + "socialMetricCount": { + "column": "socialMetricCount" + }, + "socialMetricsLastSyncedAt": { + "column": "socialMetricsLastSyncedAt" + }, + "status": { + "column": "status" + }, + "updatedAt": { + "column": "updatedAt" + }, + "urls": { + "column": "urls" + }, + "userId": { + "column": "userId" + } + }, + "table": "BountySubmission" + } + }, + "Campaign": { + "fields": { + "bodyJson": { + "nullable": false, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "from": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "preview": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "qstashMessageId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "scheduledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "subject": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "workflowId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "emails": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "campaignId" + ] + }, + "to": "NotificationEmail" + }, + "groups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "campaignId" + ] + }, + "to": "CampaignGroup" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "workflow": { + "cardinality": "N:1", + "on": { + "localFields": [ + "workflowId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Workflow" + } + }, + "storage": { + "fields": { + "bodyJson": { + "column": "bodyJson" + }, + "createdAt": { + "column": "createdAt" + }, + "from": { + "column": "from" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "preview": { + "column": "preview" + }, + "programId": { + "column": "programId" + }, + "qstashMessageId": { + "column": "qstashMessageId" + }, + "scheduledAt": { + "column": "scheduledAt" + }, + "status": { + "column": "status" + }, + "subject": { + "column": "subject" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + }, + "workflowId": { + "column": "workflowId" + } + }, + "table": "Campaign" + } + }, + "CampaignGroup": { + "fields": { + "campaignId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "groupId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + } + }, + "relations": { + "campaign": { + "cardinality": "N:1", + "on": { + "localFields": [ + "campaignId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Campaign" + }, + "partnerGroup": { + "cardinality": "N:1", + "on": { + "localFields": [ + "groupId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerGroup" + } + }, + "storage": { + "fields": { + "campaignId": { + "column": "campaignId" + }, + "groupId": { + "column": "groupId" + }, + "id": { + "column": "id" + } + }, + "table": "CampaignGroup" + } + }, + "Commission": { + "fields": { + "amount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "currency": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "customerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "earnings": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "eventId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "invoiceId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "linkId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "payoutId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "quantity": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "rewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "customer": { + "cardinality": "N:1", + "on": { + "localFields": [ + "customerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Customer" + }, + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "payout": { + "cardinality": "N:1", + "on": { + "localFields": [ + "payoutId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Payout" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "reward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "rewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "amount": { + "column": "amount" + }, + "createdAt": { + "column": "createdAt" + }, + "currency": { + "column": "currency" + }, + "customerId": { + "column": "customerId" + }, + "description": { + "column": "description" + }, + "earnings": { + "column": "earnings" + }, + "eventId": { + "column": "eventId" + }, + "id": { + "column": "id" + }, + "invoiceId": { + "column": "invoiceId" + }, + "linkId": { + "column": "linkId" + }, + "partnerId": { + "column": "partnerId" + }, + "payoutId": { + "column": "payoutId" + }, + "programId": { + "column": "programId" + }, + "quantity": { + "column": "quantity" + }, + "rewardId": { + "column": "rewardId" + }, + "status": { + "column": "status" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "Commission" + } + }, + "Customer": { + "fields": { + "avatar": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "clickId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "clickedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "country": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "email": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "externalId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "firstSaleAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "name": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectConnectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "saleAmount": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "sales": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "stripeCustomerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "subscriptionCanceledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "customerId" + ] + }, + "to": "Commission" + }, + "fraudEvents": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "customerId" + ] + }, + "to": "FraudEvent" + }, + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "referrals": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "customerId" + ] + }, + "to": "PartnerReferral" + } + }, + "storage": { + "fields": { + "avatar": { + "column": "avatar" + }, + "clickId": { + "column": "clickId" + }, + "clickedAt": { + "column": "clickedAt" + }, + "country": { + "column": "country" + }, + "createdAt": { + "column": "createdAt" + }, + "email": { + "column": "email" + }, + "externalId": { + "column": "externalId" + }, + "firstSaleAt": { + "column": "firstSaleAt" + }, + "id": { + "column": "id" + }, + "linkId": { + "column": "linkId" + }, + "name": { + "column": "name" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "projectConnectId": { + "column": "projectConnectId" + }, + "projectId": { + "column": "projectId" + }, + "saleAmount": { + "column": "saleAmount" + }, + "sales": { + "column": "sales" + }, + "stripeCustomerId": { + "column": "stripeCustomerId" + }, + "subscriptionCanceledAt": { + "column": "subscriptionCanceledAt" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Customer" + } + }, + "Dashboard": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "doIndex": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "folderId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "password": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "showConversions": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "folder": { + "cardinality": "N:1", + "on": { + "localFields": [ + "folderId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Folder" + }, + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "doIndex": { + "column": "doIndex" + }, + "folderId": { + "column": "folderId" + }, + "id": { + "column": "id" + }, + "linkId": { + "column": "linkId" + }, + "password": { + "column": "password" + }, + "projectId": { + "column": "projectId" + }, + "showConversions": { + "column": "showConversions" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "Dashboard" + } + }, + "DefaultDomains": { + "fields": { + "amznid": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "callink": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "chatgpt": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "dubsh": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "figpage": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "ggllink": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "gitnew": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "loooooooong": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "sptifi": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + } + }, + "relations": { + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "amznid": { + "column": "amznid" + }, + "callink": { + "column": "callink" + }, + "chatgpt": { + "column": "chatgpt" + }, + "dubsh": { + "column": "dubsh" + }, + "figpage": { + "column": "figpage" + }, + "ggllink": { + "column": "ggllink" + }, + "gitnew": { + "column": "gitnew" + }, + "id": { + "column": "id" + }, + "loooooooong": { + "column": "loooooooong" + }, + "projectId": { + "column": "projectId" + }, + "sptifi": { + "column": "sptifi" + } + }, + "table": "DefaultDomains" + } + }, + "Discount": { + "fields": { + "amount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "autoProvisionEnabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "couponId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "couponTestId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "maxDuration": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "provider": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "discountCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "discountId" + ] + }, + "to": "DiscountCode" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "discountId" + ] + }, + "to": "ProgramEnrollment" + } + }, + "storage": { + "fields": { + "amount": { + "column": "amount" + }, + "autoProvisionEnabledAt": { + "column": "autoProvisionEnabledAt" + }, + "couponId": { + "column": "couponId" + }, + "couponTestId": { + "column": "couponTestId" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "id": { + "column": "id" + }, + "maxDuration": { + "column": "maxDuration" + }, + "programId": { + "column": "programId" + }, + "provider": { + "column": "provider" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Discount" + } + }, + "DiscountCode": { + "fields": { + "code": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "discountId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "discount": { + "cardinality": "N:1", + "on": { + "localFields": [ + "discountId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Discount" + }, + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + } + }, + "storage": { + "fields": { + "code": { + "column": "code" + }, + "createdAt": { + "column": "createdAt" + }, + "discountId": { + "column": "discountId" + }, + "id": { + "column": "id" + }, + "linkId": { + "column": "linkId" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "DiscountCode" + } + }, + "DiscoveredPartner": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "ignoredAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "invitedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "messagedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "starredAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "ignoredAt": { + "column": "ignoredAt" + }, + "invitedAt": { + "column": "invitedAt" + }, + "messagedAt": { + "column": "messagedAt" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "starredAt": { + "column": "starredAt" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "DiscoveredPartner" + } + }, + "Domain": { + "fields": { + "appleAppSiteAssociation": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "archived": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "assetLinks": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "deepviewData": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "expiredUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "lastChecked": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "linkRetentionDays": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "logo": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "notFoundUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "placeholder": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "primary": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "verified": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + } + }, + "relations": { + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "slug" + ], + "targetFields": [ + "domain" + ] + }, + "to": "Link" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "appleAppSiteAssociation": { + "column": "appleAppSiteAssociation" + }, + "archived": { + "column": "archived" + }, + "assetLinks": { + "column": "assetLinks" + }, + "createdAt": { + "column": "createdAt" + }, + "deepviewData": { + "column": "deepviewData" + }, + "expiredUrl": { + "column": "expiredUrl" + }, + "id": { + "column": "id" + }, + "lastChecked": { + "column": "lastChecked" + }, + "linkRetentionDays": { + "column": "linkRetentionDays" + }, + "logo": { + "column": "logo" + }, + "notFoundUrl": { + "column": "notFoundUrl" + }, + "placeholder": { + "column": "placeholder" + }, + "primary": { + "column": "primary" + }, + "projectId": { + "column": "projectId" + }, + "slug": { + "column": "slug" + }, + "updatedAt": { + "column": "updatedAt" + }, + "verified": { + "column": "verified" + } + }, + "table": "Domain" + } + }, + "EmailDomain": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "lastChecked": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "resendDomainId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "workspaceId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "lastChecked": { + "column": "lastChecked" + }, + "programId": { + "column": "programId" + }, + "resendDomainId": { + "column": "resendDomainId" + }, + "slug": { + "column": "slug" + }, + "status": { + "column": "status" + }, + "updatedAt": { + "column": "updatedAt" + }, + "workspaceId": { + "column": "workspaceId" + } + }, + "table": "EmailDomain" + } + }, + "EmailVerificationToken": { + "fields": { + "expires": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "identifier": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "token": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": {}, + "storage": { + "fields": { + "expires": { + "column": "expires" + }, + "id": { + "column": "id" + }, + "identifier": { + "column": "identifier" + }, + "token": { + "column": "token" + } + }, + "table": "EmailVerificationToken" + } + }, + "Folder": { + "fields": { + "accessLevel": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "accessRequests": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "folderId" + ] + }, + "to": "FolderAccessRequest" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "folderId" + ] + }, + "to": "Link" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "users": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "folderId" + ] + }, + "to": "FolderUser" + } + }, + "storage": { + "fields": { + "accessLevel": { + "column": "accessLevel" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "projectId": { + "column": "projectId" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Folder" + } + }, + "FolderAccessRequest": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "folderId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "folder": { + "cardinality": "N:1", + "on": { + "localFields": [ + "folderId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Folder" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "folderId": { + "column": "folderId" + }, + "id": { + "column": "id" + }, + "userId": { + "column": "userId" + } + }, + "table": "FolderAccessRequest" + } + }, + "FolderUser": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "folderId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "role": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "folder": { + "cardinality": "N:1", + "on": { + "localFields": [ + "folderId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Folder" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "folderId": { + "column": "folderId" + }, + "id": { + "column": "id" + }, + "role": { + "column": "role" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "FolderUser" + } + }, + "FraudAlert": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "reason": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "reviewNote": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "reviewedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "reviewedById": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "reviewedBy": { + "cardinality": "N:1", + "on": { + "localFields": [ + "reviewedById" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "reason": { + "column": "reason" + }, + "reviewNote": { + "column": "reviewNote" + }, + "reviewedAt": { + "column": "reviewedAt" + }, + "reviewedById": { + "column": "reviewedById" + }, + "status": { + "column": "status" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "FraudAlert" + } + }, + "FraudEvent": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "customerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "eventId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "fraudEventGroupId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "hash": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "metadata": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "sourceProgramId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "customer": { + "cardinality": "N:1", + "on": { + "localFields": [ + "customerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Customer" + }, + "fraudEventGroup": { + "cardinality": "N:1", + "on": { + "localFields": [ + "fraudEventGroupId" + ], + "targetFields": [ + "id" + ] + }, + "to": "FraudEventGroup" + }, + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "sourceProgram": { + "cardinality": "N:1", + "on": { + "localFields": [ + "sourceProgramId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "customerId": { + "column": "customerId" + }, + "eventId": { + "column": "eventId" + }, + "fraudEventGroupId": { + "column": "fraudEventGroupId" + }, + "hash": { + "column": "hash" + }, + "id": { + "column": "id" + }, + "linkId": { + "column": "linkId" + }, + "metadata": { + "column": "metadata" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "sourceProgramId": { + "column": "sourceProgramId" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "FraudEvent" + } + }, + "FraudEventGroup": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "eventCount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "lastEventAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "resolutionReason": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "resolvedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "fraudEvents": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "fraudEventGroupId" + ] + }, + "to": "FraudEvent" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "eventCount": { + "column": "eventCount" + }, + "id": { + "column": "id" + }, + "lastEventAt": { + "column": "lastEventAt" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "resolutionReason": { + "column": "resolutionReason" + }, + "resolvedAt": { + "column": "resolvedAt" + }, + "status": { + "column": "status" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "FraudEventGroup" + } + }, + "FraudRule": { + "fields": { + "config": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "disabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "config": { + "column": "config" + }, + "createdAt": { + "column": "createdAt" + }, + "disabledAt": { + "column": "disabledAt" + }, + "id": { + "column": "id" + }, + "programId": { + "column": "programId" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "FraudRule" + } + }, + "InstalledIntegration": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "credentials": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "integrationId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "settings": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "accessTokens": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "installationId" + ] + }, + "to": "RestrictedToken" + }, + "integration": { + "cardinality": "N:1", + "on": { + "localFields": [ + "integrationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Integration" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "refreshTokens": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "installationId" + ] + }, + "to": "OAuthRefreshToken" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + }, + "webhooks": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "installationId" + ] + }, + "to": "Webhook" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "credentials": { + "column": "credentials" + }, + "id": { + "column": "id" + }, + "integrationId": { + "column": "integrationId" + }, + "projectId": { + "column": "projectId" + }, + "settings": { + "column": "settings" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "InstalledIntegration" + } + }, + "Integration": { + "fields": { + "category": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "comingSoon": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "developer": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "guideUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "installUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "logo": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "readme": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "screenshots": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "verified": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "website": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "installations": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "integrationId" + ] + }, + "to": "InstalledIntegration" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "category": { + "column": "category" + }, + "comingSoon": { + "column": "comingSoon" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "developer": { + "column": "developer" + }, + "guideUrl": { + "column": "guideUrl" + }, + "id": { + "column": "id" + }, + "installUrl": { + "column": "installUrl" + }, + "logo": { + "column": "logo" + }, + "name": { + "column": "name" + }, + "projectId": { + "column": "projectId" + }, + "readme": { + "column": "readme" + }, + "screenshots": { + "column": "screenshots" + }, + "slug": { + "column": "slug" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + }, + "verified": { + "column": "verified" + }, + "website": { + "column": "website" + } + }, + "table": "Integration" + } + }, + "Invoice": { + "fields": { + "amount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "externalAmount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "failedAttempts": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "failedReason": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "fee": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "number": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "paidAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "paymentMethod": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "payoutMode": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "receiptUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "registeredDomains": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "stripeChargeMetadata": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "total": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "workspaceId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "payouts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "invoiceId" + ] + }, + "to": "Payout" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "workspace": { + "cardinality": "N:1", + "on": { + "localFields": [ + "workspaceId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "amount": { + "column": "amount" + }, + "createdAt": { + "column": "createdAt" + }, + "externalAmount": { + "column": "externalAmount" + }, + "failedAttempts": { + "column": "failedAttempts" + }, + "failedReason": { + "column": "failedReason" + }, + "fee": { + "column": "fee" + }, + "id": { + "column": "id" + }, + "number": { + "column": "number" + }, + "paidAt": { + "column": "paidAt" + }, + "paymentMethod": { + "column": "paymentMethod" + }, + "payoutMode": { + "column": "payoutMode" + }, + "programId": { + "column": "programId" + }, + "receiptUrl": { + "column": "receiptUrl" + }, + "registeredDomains": { + "column": "registeredDomains" + }, + "status": { + "column": "status" + }, + "stripeChargeMetadata": { + "column": "stripeChargeMetadata" + }, + "total": { + "column": "total" + }, + "type": { + "column": "type" + }, + "workspaceId": { + "column": "workspaceId" + } + }, + "table": "Invoice" + } + }, + "Link": { + "fields": { + "android": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "archived": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "clicks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "comments": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "conversions": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "disabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "doIndex": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "domain": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "expiredUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "expiresAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "externalId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "folderId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "geo": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "image": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "ios": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "key": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "lastClicked": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "lastConversionAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "lastLeadAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "leads": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "linkRetentionCleanupDisabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "partnerGroupDefaultLinkId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "password": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "proxy": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "publicStats": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "rewrite": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "saleAmount": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "sales": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "shortLink": { + "nullable": false, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "tenantId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "testCompletedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "testStartedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "testVariants": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "title": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "trackConversion": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "url": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_campaign": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_content": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_medium": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_source": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_term": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "video": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "linkId" + ] + }, + "to": "Commission" + }, + "customers": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "linkId" + ] + }, + "to": "Customer" + }, + "folder": { + "cardinality": "N:1", + "on": { + "localFields": [ + "folderId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Folder" + }, + "fraudEvents": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "linkId" + ] + }, + "to": "FraudEvent" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "partnerGroupDefaultLink": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerGroupDefaultLinkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerGroupDefaultLink" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "shortDomain": { + "cardinality": "N:1", + "on": { + "localFields": [ + "domain" + ], + "targetFields": [ + "slug" + ] + }, + "to": "Domain" + }, + "tags": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "linkId" + ] + }, + "to": "LinkTag" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + }, + "webhooks": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "linkId" + ] + }, + "to": "LinkWebhook" + } + }, + "storage": { + "fields": { + "android": { + "column": "android" + }, + "archived": { + "column": "archived" + }, + "clicks": { + "column": "clicks" + }, + "comments": { + "column": "comments" + }, + "conversions": { + "column": "conversions" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "disabledAt": { + "column": "disabledAt" + }, + "doIndex": { + "column": "doIndex" + }, + "domain": { + "column": "domain" + }, + "expiredUrl": { + "column": "expiredUrl" + }, + "expiresAt": { + "column": "expiresAt" + }, + "externalId": { + "column": "externalId" + }, + "folderId": { + "column": "folderId" + }, + "geo": { + "column": "geo" + }, + "id": { + "column": "id" + }, + "image": { + "column": "image" + }, + "ios": { + "column": "ios" + }, + "key": { + "column": "key" + }, + "lastClicked": { + "column": "lastClicked" + }, + "lastConversionAt": { + "column": "lastConversionAt" + }, + "lastLeadAt": { + "column": "lastLeadAt" + }, + "leads": { + "column": "leads" + }, + "linkRetentionCleanupDisabledAt": { + "column": "linkRetentionCleanupDisabledAt" + }, + "partnerGroupDefaultLinkId": { + "column": "partnerGroupDefaultLinkId" + }, + "partnerId": { + "column": "partnerId" + }, + "password": { + "column": "password" + }, + "programId": { + "column": "programId" + }, + "projectId": { + "column": "projectId" + }, + "proxy": { + "column": "proxy" + }, + "publicStats": { + "column": "publicStats" + }, + "rewrite": { + "column": "rewrite" + }, + "saleAmount": { + "column": "saleAmount" + }, + "sales": { + "column": "sales" + }, + "shortLink": { + "column": "shortLink" + }, + "tenantId": { + "column": "tenantId" + }, + "testCompletedAt": { + "column": "testCompletedAt" + }, + "testStartedAt": { + "column": "testStartedAt" + }, + "testVariants": { + "column": "testVariants" + }, + "title": { + "column": "title" + }, + "trackConversion": { + "column": "trackConversion" + }, + "updatedAt": { + "column": "updatedAt" + }, + "url": { + "column": "url" + }, + "userId": { + "column": "userId" + }, + "utm_campaign": { + "column": "utm_campaign" + }, + "utm_content": { + "column": "utm_content" + }, + "utm_medium": { + "column": "utm_medium" + }, + "utm_source": { + "column": "utm_source" + }, + "utm_term": { + "column": "utm_term" + }, + "video": { + "column": "video" + } + }, + "table": "Link" + } + }, + "LinkTag": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "tagId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "tag": { + "cardinality": "N:1", + "on": { + "localFields": [ + "tagId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Tag" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "linkId": { + "column": "linkId" + }, + "tagId": { + "column": "tagId" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "LinkTag" + } + }, + "LinkWebhook": { + "fields": { + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "webhookId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "link": { + "cardinality": "N:1", + "on": { + "localFields": [ + "linkId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Link" + }, + "webhook": { + "cardinality": "N:1", + "on": { + "localFields": [ + "webhookId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Webhook" + } + }, + "storage": { + "fields": { + "id": { + "column": "id" + }, + "linkId": { + "column": "linkId" + }, + "webhookId": { + "column": "webhookId" + } + }, + "table": "LinkWebhook" + } + }, + "Message": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "readInApp": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "readInEmail": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "senderPartnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "senderUserId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "subject": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "text": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "emails": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "messageId" + ] + }, + "to": "NotificationEmail" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "senderPartner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "senderPartnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "senderUser": { + "cardinality": "N:1", + "on": { + "localFields": [ + "senderUserId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "readInApp": { + "column": "readInApp" + }, + "readInEmail": { + "column": "readInEmail" + }, + "senderPartnerId": { + "column": "senderPartnerId" + }, + "senderUserId": { + "column": "senderUserId" + }, + "subject": { + "column": "subject" + }, + "text": { + "column": "text" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Message" + } + }, + "NotificationEmail": { + "fields": { + "bouncedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "bountyId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "campaignId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "deliveredAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "emailId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "messageId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "openedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "recipientUserId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + } + }, + "relations": { + "bounty": { + "cardinality": "N:1", + "on": { + "localFields": [ + "bountyId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Bounty" + }, + "campaign": { + "cardinality": "N:1", + "on": { + "localFields": [ + "campaignId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Campaign" + }, + "message": { + "cardinality": "N:1", + "on": { + "localFields": [ + "messageId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Message" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "bouncedAt": { + "column": "bouncedAt" + }, + "bountyId": { + "column": "bountyId" + }, + "campaignId": { + "column": "campaignId" + }, + "createdAt": { + "column": "createdAt" + }, + "deliveredAt": { + "column": "deliveredAt" + }, + "emailId": { + "column": "emailId" + }, + "id": { + "column": "id" + }, + "messageId": { + "column": "messageId" + }, + "openedAt": { + "column": "openedAt" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "recipientUserId": { + "column": "recipientUserId" + }, + "type": { + "column": "type" + } + }, + "table": "NotificationEmail" + } + }, + "NotificationPreference": { + "fields": { + "domainConfigurationUpdates": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "fraudEventsSummary": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "linkUsageSummary": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "newBountySubmitted": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "newMessageFromPartner": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "newPartnerApplication": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "newPartnerSale": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "pendingApplicationsSummary": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "projectUserId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "projectUser": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectUserId" + ], + "targetFields": [ + "id" + ] + }, + "to": "ProjectUsers" + } + }, + "storage": { + "fields": { + "domainConfigurationUpdates": { + "column": "domainConfigurationUpdates" + }, + "fraudEventsSummary": { + "column": "fraudEventsSummary" + }, + "id": { + "column": "id" + }, + "linkUsageSummary": { + "column": "linkUsageSummary" + }, + "newBountySubmitted": { + "column": "newBountySubmitted" + }, + "newMessageFromPartner": { + "column": "newMessageFromPartner" + }, + "newPartnerApplication": { + "column": "newPartnerApplication" + }, + "newPartnerSale": { + "column": "newPartnerSale" + }, + "pendingApplicationsSummary": { + "column": "pendingApplicationsSummary" + }, + "projectUserId": { + "column": "projectUserId" + } + }, + "table": "NotificationPreference" + } + }, + "OAuthApp": { + "fields": { + "clientId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "hashedClientSecret": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "integrationId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partialClientSecret": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "pkce": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "redirectUris": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + } + }, + "relations": { + "integration": { + "cardinality": "N:1", + "on": { + "localFields": [ + "integrationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Integration" + }, + "oAuthCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "clientId" + ], + "targetFields": [ + "clientId" + ] + }, + "to": "OAuthCode" + } + }, + "storage": { + "fields": { + "clientId": { + "column": "clientId" + }, + "hashedClientSecret": { + "column": "hashedClientSecret" + }, + "id": { + "column": "id" + }, + "integrationId": { + "column": "integrationId" + }, + "partialClientSecret": { + "column": "partialClientSecret" + }, + "pkce": { + "column": "pkce" + }, + "redirectUris": { + "column": "redirectUris" + } + }, + "table": "OAuthApp" + } + }, + "OAuthCode": { + "fields": { + "clientId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "code": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "codeChallenge": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "codeChallengeMethod": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "expiresAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "redirectUri": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "scopes": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "oAuthApp": { + "cardinality": "N:1", + "on": { + "localFields": [ + "clientId" + ], + "targetFields": [ + "clientId" + ] + }, + "to": "OAuthApp" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "clientId": { + "column": "clientId" + }, + "code": { + "column": "code" + }, + "codeChallenge": { + "column": "codeChallenge" + }, + "codeChallengeMethod": { + "column": "codeChallengeMethod" + }, + "createdAt": { + "column": "createdAt" + }, + "expiresAt": { + "column": "expiresAt" + }, + "id": { + "column": "id" + }, + "projectId": { + "column": "projectId" + }, + "redirectUri": { + "column": "redirectUri" + }, + "scopes": { + "column": "scopes" + }, + "userId": { + "column": "userId" + } + }, + "table": "OAuthCode" + } + }, + "OAuthRefreshToken": { + "fields": { + "accessTokenId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "expiresAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "hashedRefreshToken": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "installationId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "accessToken": { + "cardinality": "N:1", + "on": { + "localFields": [ + "accessTokenId" + ], + "targetFields": [ + "id" + ] + }, + "to": "RestrictedToken" + }, + "installedIntegration": { + "cardinality": "N:1", + "on": { + "localFields": [ + "installationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "InstalledIntegration" + } + }, + "storage": { + "fields": { + "accessTokenId": { + "column": "accessTokenId" + }, + "createdAt": { + "column": "createdAt" + }, + "expiresAt": { + "column": "expiresAt" + }, + "hashedRefreshToken": { + "column": "hashedRefreshToken" + }, + "id": { + "column": "id" + }, + "installationId": { + "column": "installationId" + } + }, + "table": "OAuthRefreshToken" + } + }, + "Partner": { + "fields": { + "changeHistoryLog": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "companyName": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "connectPayoutsLastRemindedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "country": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "cryptoWalletAddress": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "defaultPayoutMethod": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "discoverableAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "email": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "identityVerificationStatus": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "identityVerifiedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "image": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "invoiceSettings": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "monthlyTraffic": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "payoutMethodHash": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "payoutsEnabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "paypalEmail": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "profileType": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "referredByPartnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "stripeConnectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "stripeRecipientId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "trustedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "username": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "veriffMetadata": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "veriffSessionId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "bountySubmissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "BountySubmission" + }, + "comments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerComment" + }, + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "Commission" + }, + "customers": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "Customer" + }, + "discountCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "DiscountCode" + }, + "discoveredByPrograms": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "DiscoveredPartner" + }, + "fraudAlerts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "FraudAlert" + }, + "fraudEventGroups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "FraudEventGroup" + }, + "fraudEvents": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "FraudEvent" + }, + "industryInterests": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerIndustryInterest" + }, + "invites": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerInvite" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "Link" + }, + "messages": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "Message" + }, + "notificationEmails": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "NotificationEmail" + }, + "partnerRewinds": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerRewind" + }, + "payouts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "Payout" + }, + "platforms": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerPlatform" + }, + "postbacks": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "Postback" + }, + "preferredEarningStructures": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerPreferredEarningStructure" + }, + "programs": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "referrals": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerReferral" + }, + "referredApplications": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "referredByPartnerId" + ] + }, + "to": "ProgramApplicationEvent" + }, + "salesChannels": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerSalesChannel" + }, + "sentMessages": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "senderPartnerId" + ] + }, + "to": "Message" + }, + "users": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerId" + ] + }, + "to": "PartnerUser" + } + }, + "storage": { + "fields": { + "changeHistoryLog": { + "column": "changeHistoryLog" + }, + "companyName": { + "column": "companyName" + }, + "connectPayoutsLastRemindedAt": { + "column": "connectPayoutsLastRemindedAt" + }, + "country": { + "column": "country" + }, + "createdAt": { + "column": "createdAt" + }, + "cryptoWalletAddress": { + "column": "cryptoWalletAddress" + }, + "defaultPayoutMethod": { + "column": "defaultPayoutMethod" + }, + "description": { + "column": "description" + }, + "discoverableAt": { + "column": "discoverableAt" + }, + "email": { + "column": "email" + }, + "id": { + "column": "id" + }, + "identityVerificationStatus": { + "column": "identityVerificationStatus" + }, + "identityVerifiedAt": { + "column": "identityVerifiedAt" + }, + "image": { + "column": "image" + }, + "invoiceSettings": { + "column": "invoiceSettings" + }, + "monthlyTraffic": { + "column": "monthlyTraffic" + }, + "name": { + "column": "name" + }, + "payoutMethodHash": { + "column": "payoutMethodHash" + }, + "payoutsEnabledAt": { + "column": "payoutsEnabledAt" + }, + "paypalEmail": { + "column": "paypalEmail" + }, + "profileType": { + "column": "profileType" + }, + "referredByPartnerId": { + "column": "referredByPartnerId" + }, + "stripeConnectId": { + "column": "stripeConnectId" + }, + "stripeRecipientId": { + "column": "stripeRecipientId" + }, + "trustedAt": { + "column": "trustedAt" + }, + "updatedAt": { + "column": "updatedAt" + }, + "username": { + "column": "username" + }, + "veriffMetadata": { + "column": "veriffMetadata" + }, + "veriffSessionId": { + "column": "veriffSessionId" + } + }, + "table": "Partner" + } + }, + "PartnerComment": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "text": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "text": { + "column": "text" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "PartnerComment" + } + }, + "PartnerGroup": { + "fields": { + "additionalLinks": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "applicationFormData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "applicationFormPublishedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "autoApprovePartnersEnabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "brandColor": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "clickRewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "color": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "discountId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "holdingPeriodDays": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "landerData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "landerPublishedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "leadRewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "linkStructure": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "logo": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "maxPartnerLinks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "saleRewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "utmTemplateId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "wordmark": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "workflowId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "applications": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "groupId" + ] + }, + "to": "ProgramApplication" + }, + "bounties": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "groupId" + ] + }, + "to": "BountyGroup" + }, + "campaigns": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "groupId" + ] + }, + "to": "CampaignGroup" + }, + "clickReward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "clickRewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + }, + "discount": { + "cardinality": "N:1", + "on": { + "localFields": [ + "discountId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Discount" + }, + "leadReward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "leadRewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + }, + "partnerGroupDefaultLinks": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "groupId" + ] + }, + "to": "PartnerGroupDefaultLink" + }, + "partners": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "groupId" + ] + }, + "to": "ProgramEnrollment" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "saleReward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "saleRewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + }, + "utmTemplate": { + "cardinality": "N:1", + "on": { + "localFields": [ + "utmTemplateId" + ], + "targetFields": [ + "id" + ] + }, + "to": "UtmTemplate" + }, + "workflow": { + "cardinality": "N:1", + "on": { + "localFields": [ + "workflowId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Workflow" + } + }, + "storage": { + "fields": { + "additionalLinks": { + "column": "additionalLinks" + }, + "applicationFormData": { + "column": "applicationFormData" + }, + "applicationFormPublishedAt": { + "column": "applicationFormPublishedAt" + }, + "autoApprovePartnersEnabledAt": { + "column": "autoApprovePartnersEnabledAt" + }, + "brandColor": { + "column": "brandColor" + }, + "clickRewardId": { + "column": "clickRewardId" + }, + "color": { + "column": "color" + }, + "createdAt": { + "column": "createdAt" + }, + "discountId": { + "column": "discountId" + }, + "holdingPeriodDays": { + "column": "holdingPeriodDays" + }, + "id": { + "column": "id" + }, + "landerData": { + "column": "landerData" + }, + "landerPublishedAt": { + "column": "landerPublishedAt" + }, + "leadRewardId": { + "column": "leadRewardId" + }, + "linkStructure": { + "column": "linkStructure" + }, + "logo": { + "column": "logo" + }, + "maxPartnerLinks": { + "column": "maxPartnerLinks" + }, + "name": { + "column": "name" + }, + "programId": { + "column": "programId" + }, + "saleRewardId": { + "column": "saleRewardId" + }, + "slug": { + "column": "slug" + }, + "updatedAt": { + "column": "updatedAt" + }, + "utmTemplateId": { + "column": "utmTemplateId" + }, + "wordmark": { + "column": "wordmark" + }, + "workflowId": { + "column": "workflowId" + } + }, + "table": "PartnerGroup" + } + }, + "PartnerGroupDefaultLink": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "domain": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "groupId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "url": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "partnerGroupDefaultLinkId" + ] + }, + "to": "Link" + }, + "partnerGroup": { + "cardinality": "N:1", + "on": { + "localFields": [ + "groupId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerGroup" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "domain": { + "column": "domain" + }, + "groupId": { + "column": "groupId" + }, + "id": { + "column": "id" + }, + "programId": { + "column": "programId" + }, + "updatedAt": { + "column": "updatedAt" + }, + "url": { + "column": "url" + } + }, + "table": "PartnerGroupDefaultLink" + } + }, + "PartnerIndustryInterest": { + "fields": { + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "industryInterest": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "id": { + "column": "id" + }, + "industryInterest": { + "column": "industryInterest" + }, + "partnerId": { + "column": "partnerId" + } + }, + "table": "PartnerIndustryInterest" + } + }, + "PartnerInvite": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "email": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "expires": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "role": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "email": { + "column": "email" + }, + "expires": { + "column": "expires" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "role": { + "column": "role" + } + }, + "table": "PartnerInvite" + } + }, + "PartnerNotificationPreferences": { + "fields": { + "applicationApproved": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "commissionCreated": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "connectPayoutReminder": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "marketingCampaign": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "monthlyProgramSummary": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "newMessageFromProgram": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "partnerUserId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "partnerUser": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerUserId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerUser" + } + }, + "storage": { + "fields": { + "applicationApproved": { + "column": "applicationApproved" + }, + "commissionCreated": { + "column": "commissionCreated" + }, + "connectPayoutReminder": { + "column": "connectPayoutReminder" + }, + "id": { + "column": "id" + }, + "marketingCampaign": { + "column": "marketingCampaign" + }, + "monthlyProgramSummary": { + "column": "monthlyProgramSummary" + }, + "newMessageFromProgram": { + "column": "newMessageFromProgram" + }, + "partnerUserId": { + "column": "partnerUserId" + } + }, + "table": "PartnerNotificationPreferences" + } + }, + "PartnerPlatform": { + "fields": { + "avatarUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "identifier": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "lastCheckedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "metadata": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "platformId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "posts": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "subscribers": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "verifiedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "views": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "avatarUrl": { + "column": "avatarUrl" + }, + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "identifier": { + "column": "identifier" + }, + "lastCheckedAt": { + "column": "lastCheckedAt" + }, + "metadata": { + "column": "metadata" + }, + "partnerId": { + "column": "partnerId" + }, + "platformId": { + "column": "platformId" + }, + "posts": { + "column": "posts" + }, + "subscribers": { + "column": "subscribers" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + }, + "verifiedAt": { + "column": "verifiedAt" + }, + "views": { + "column": "views" + } + }, + "table": "PartnerPlatform" + } + }, + "PartnerPreferredEarningStructure": { + "fields": { + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "preferredEarningStructure": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "preferredEarningStructure": { + "column": "preferredEarningStructure" + } + }, + "table": "PartnerPreferredEarningStructure" + } + }, + "PartnerReferral": { + "fields": { + "company": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "customerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "email": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "formData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "customer": { + "cardinality": "N:1", + "on": { + "localFields": [ + "customerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Customer" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + } + }, + "storage": { + "fields": { + "company": { + "column": "company" + }, + "createdAt": { + "column": "createdAt" + }, + "customerId": { + "column": "customerId" + }, + "email": { + "column": "email" + }, + "formData": { + "column": "formData" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "status": { + "column": "status" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "PartnerReferral" + } + }, + "PartnerRewind": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "sentAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "totalClicks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalEarnings": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalLeads": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalRevenue": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "year": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "sentAt": { + "column": "sentAt" + }, + "totalClicks": { + "column": "totalClicks" + }, + "totalEarnings": { + "column": "totalEarnings" + }, + "totalLeads": { + "column": "totalLeads" + }, + "totalRevenue": { + "column": "totalRevenue" + }, + "year": { + "column": "year" + } + }, + "table": "PartnerRewind" + } + }, + "PartnerSalesChannel": { + "fields": { + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "salesChannel": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "salesChannel": { + "column": "salesChannel" + } + }, + "table": "PartnerSalesChannel" + } + }, + "PartnerUser": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "role": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "partnerId": { + "column": "partnerId" + }, + "role": { + "column": "role" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "PartnerUser" + } + }, + "PasswordResetToken": { + "fields": { + "expires": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "identifier": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "token": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": {}, + "storage": { + "fields": { + "expires": { + "column": "expires" + }, + "id": { + "column": "id" + }, + "identifier": { + "column": "identifier" + }, + "token": { + "column": "token" + } + }, + "table": "PasswordResetToken" + } + }, + "Payout": { + "fields": { + "amount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "currency": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "failureReason": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "initiatedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "invoiceId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "method": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "mode": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "paidAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "paypalTransferId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "periodEnd": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "periodStart": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "stripePayoutId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "stripePayoutTraceId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "stripeTransferId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "webhookEventId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "payoutId" + ] + }, + "to": "Commission" + }, + "invoice": { + "cardinality": "N:1", + "on": { + "localFields": [ + "invoiceId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Invoice" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programEnrollment": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "ProgramEnrollment" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "amount": { + "column": "amount" + }, + "createdAt": { + "column": "createdAt" + }, + "currency": { + "column": "currency" + }, + "description": { + "column": "description" + }, + "failureReason": { + "column": "failureReason" + }, + "id": { + "column": "id" + }, + "initiatedAt": { + "column": "initiatedAt" + }, + "invoiceId": { + "column": "invoiceId" + }, + "method": { + "column": "method" + }, + "mode": { + "column": "mode" + }, + "paidAt": { + "column": "paidAt" + }, + "partnerId": { + "column": "partnerId" + }, + "paypalTransferId": { + "column": "paypalTransferId" + }, + "periodEnd": { + "column": "periodEnd" + }, + "periodStart": { + "column": "periodStart" + }, + "programId": { + "column": "programId" + }, + "status": { + "column": "status" + }, + "stripePayoutId": { + "column": "stripePayoutId" + }, + "stripePayoutTraceId": { + "column": "stripePayoutTraceId" + }, + "stripeTransferId": { + "column": "stripeTransferId" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + }, + "webhookEventId": { + "column": "webhookEventId" + } + }, + "table": "Payout" + } + }, + "Postback": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "disabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "receiver": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "secret": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "triggers": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "url": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "disabledAt": { + "column": "disabledAt" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "partnerId": { + "column": "partnerId" + }, + "receiver": { + "column": "receiver" + }, + "secret": { + "column": "secret" + }, + "triggers": { + "column": "triggers" + }, + "updatedAt": { + "column": "updatedAt" + }, + "url": { + "column": "url" + } + }, + "table": "Postback" + } + }, + "Program": { + "fields": { + "addedToMarketplaceAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "applicationRequirements": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "deactivatedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "defaultFolderId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "defaultGroupId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "domain": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "embedData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "featuredOnMarketplaceAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "helpUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "inviteEmailData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "logo": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "marketplaceHeaderImage": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "marketplaceRanking": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "messagingEnabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "minPayoutAmount": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partnerNetworkEnabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "payoutMode": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "primaryRewardEvent": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "referralFormData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "resources": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "startedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "supportEmail": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "termsUrl": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "url": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "workspaceId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "applications": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "ProgramApplication" + }, + "bounties": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Bounty" + }, + "bountySubmissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "BountySubmission" + }, + "campaigns": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Campaign" + }, + "categories": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "ProgramCategory" + }, + "comments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "PartnerComment" + }, + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Commission" + }, + "customDomain": { + "cardinality": "N:1", + "on": { + "localFields": [ + "domain" + ], + "targetFields": [ + "slug" + ] + }, + "to": "Domain" + }, + "customers": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Customer" + }, + "discountCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "DiscountCode" + }, + "discounts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Discount" + }, + "discoveredPartners": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "DiscoveredPartner" + }, + "emailDomains": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "EmailDomain" + }, + "fraudAlerts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "FraudAlert" + }, + "fraudEventGroups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "FraudEventGroup" + }, + "fraudRules": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "FraudRule" + }, + "groups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "PartnerGroup" + }, + "invoices": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Invoice" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Link" + }, + "messages": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Message" + }, + "partnerGroupDefaultLinks": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "PartnerGroupDefaultLink" + }, + "partners": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "ProgramEnrollment" + }, + "payouts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Payout" + }, + "referrals": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "PartnerReferral" + }, + "rewards": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Reward" + }, + "similarPrograms": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "ProgramSimilarity" + }, + "similarToPrograms": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "similarProgramId" + ] + }, + "to": "ProgramSimilarity" + }, + "sourceFraudEvents": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "sourceProgramId" + ] + }, + "to": "FraudEvent" + }, + "workflows": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programId" + ] + }, + "to": "Workflow" + }, + "workspace": { + "cardinality": "N:1", + "on": { + "localFields": [ + "workspaceId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "addedToMarketplaceAt": { + "column": "addedToMarketplaceAt" + }, + "applicationRequirements": { + "column": "applicationRequirements" + }, + "createdAt": { + "column": "createdAt" + }, + "deactivatedAt": { + "column": "deactivatedAt" + }, + "defaultFolderId": { + "column": "defaultFolderId" + }, + "defaultGroupId": { + "column": "defaultGroupId" + }, + "description": { + "column": "description" + }, + "domain": { + "column": "domain" + }, + "embedData": { + "column": "embedData" + }, + "featuredOnMarketplaceAt": { + "column": "featuredOnMarketplaceAt" + }, + "helpUrl": { + "column": "helpUrl" + }, + "id": { + "column": "id" + }, + "inviteEmailData": { + "column": "inviteEmailData" + }, + "logo": { + "column": "logo" + }, + "marketplaceHeaderImage": { + "column": "marketplaceHeaderImage" + }, + "marketplaceRanking": { + "column": "marketplaceRanking" + }, + "messagingEnabledAt": { + "column": "messagingEnabledAt" + }, + "minPayoutAmount": { + "column": "minPayoutAmount" + }, + "name": { + "column": "name" + }, + "partnerNetworkEnabledAt": { + "column": "partnerNetworkEnabledAt" + }, + "payoutMode": { + "column": "payoutMode" + }, + "primaryRewardEvent": { + "column": "primaryRewardEvent" + }, + "referralFormData": { + "column": "referralFormData" + }, + "resources": { + "column": "resources" + }, + "slug": { + "column": "slug" + }, + "startedAt": { + "column": "startedAt" + }, + "supportEmail": { + "column": "supportEmail" + }, + "termsUrl": { + "column": "termsUrl" + }, + "updatedAt": { + "column": "updatedAt" + }, + "url": { + "column": "url" + }, + "workspaceId": { + "column": "workspaceId" + } + }, + "table": "Program" + } + }, + "ProgramApplication": { + "fields": { + "country": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "email": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "formData": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "groupId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "instagram": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "linkedin": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "rejectionNote": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "rejectionReason": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "reviewedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "tiktok": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "twitter": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "website": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "youtube": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "partnerGroup": { + "cardinality": "N:1", + "on": { + "localFields": [ + "groupId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerGroup" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "programApplicationEvents": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "programApplicationId" + ] + }, + "to": "ProgramApplicationEvent" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "country": { + "column": "country" + }, + "createdAt": { + "column": "createdAt" + }, + "email": { + "column": "email" + }, + "formData": { + "column": "formData" + }, + "groupId": { + "column": "groupId" + }, + "id": { + "column": "id" + }, + "instagram": { + "column": "instagram" + }, + "linkedin": { + "column": "linkedin" + }, + "name": { + "column": "name" + }, + "programId": { + "column": "programId" + }, + "rejectionNote": { + "column": "rejectionNote" + }, + "rejectionReason": { + "column": "rejectionReason" + }, + "reviewedAt": { + "column": "reviewedAt" + }, + "tiktok": { + "column": "tiktok" + }, + "twitter": { + "column": "twitter" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + }, + "website": { + "column": "website" + }, + "youtube": { + "column": "youtube" + } + }, + "table": "ProgramApplication" + } + }, + "ProgramApplicationEvent": { + "fields": { + "approvedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "country": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "metadata": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programApplicationId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "referralSource": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "referredByPartnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "rejectedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "startedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "submittedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "visitedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + } + }, + "relations": { + "application": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programApplicationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "ProgramApplication" + }, + "referredByPartner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "referredByPartnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + } + }, + "storage": { + "fields": { + "approvedAt": { + "column": "approvedAt" + }, + "country": { + "column": "country" + }, + "id": { + "column": "id" + }, + "metadata": { + "column": "metadata" + }, + "partnerId": { + "column": "partnerId" + }, + "programApplicationId": { + "column": "programApplicationId" + }, + "programId": { + "column": "programId" + }, + "referralSource": { + "column": "referralSource" + }, + "referredByPartnerId": { + "column": "referredByPartnerId" + }, + "rejectedAt": { + "column": "rejectedAt" + }, + "startedAt": { + "column": "startedAt" + }, + "submittedAt": { + "column": "submittedAt" + }, + "visitedAt": { + "column": "visitedAt" + } + }, + "table": "ProgramApplicationEvent" + } + }, + "ProgramCategory": { + "fields": { + "category": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "category": { + "column": "category" + }, + "id": { + "column": "id" + }, + "programId": { + "column": "programId" + } + }, + "table": "ProgramCategory" + } + }, + "ProgramEnrollment": { + "fields": { + "applicationId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "averageLifetimeValue": { + "nullable": true, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "bannedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "bannedReason": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "clickRewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "clickToConversionRate": { + "nullable": true, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "clickToLeadRate": { + "nullable": true, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "consistencyScore": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "customerDataSharingEnabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "daysSinceLastConversion": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "discountId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "earningsPerClick": { + "nullable": false, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "groupId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "groupMoveDisabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "lastConversionAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "leadRewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "leadToConversionRate": { + "nullable": true, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "netRevenue": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "partnerId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "returnOnAdSpend": { + "nullable": true, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "saleRewardId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "status": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "tenantId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "totalClicks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalCommissions": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "totalConversions": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalLeads": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalSaleAmount": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "totalSales": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "application": { + "cardinality": "N:1", + "on": { + "localFields": [ + "applicationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "ProgramApplication" + }, + "bountySubmissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "BountySubmission" + }, + "clickReward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "clickRewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + }, + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "Commission" + }, + "customers": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "Customer" + }, + "discount": { + "cardinality": "N:1", + "on": { + "localFields": [ + "discountId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Discount" + }, + "discountCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "DiscountCode" + }, + "fraudAlerts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "FraudAlert" + }, + "fraudEventGroups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "FraudEventGroup" + }, + "leadReward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "leadRewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "Link" + }, + "messages": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "Message" + }, + "partner": { + "cardinality": "N:1", + "on": { + "localFields": [ + "partnerId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Partner" + }, + "partnerGroup": { + "cardinality": "N:1", + "on": { + "localFields": [ + "groupId" + ], + "targetFields": [ + "id" + ] + }, + "to": "PartnerGroup" + }, + "payouts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "Payout" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "referrals": { + "cardinality": "1:N", + "on": { + "localFields": [ + "programId", + "partnerId" + ], + "targetFields": [ + "programId", + "partnerId" + ] + }, + "to": "PartnerReferral" + }, + "saleReward": { + "cardinality": "N:1", + "on": { + "localFields": [ + "saleRewardId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Reward" + } + }, + "storage": { + "fields": { + "applicationId": { + "column": "applicationId" + }, + "averageLifetimeValue": { + "column": "averageLifetimeValue" + }, + "bannedAt": { + "column": "bannedAt" + }, + "bannedReason": { + "column": "bannedReason" + }, + "clickRewardId": { + "column": "clickRewardId" + }, + "clickToConversionRate": { + "column": "clickToConversionRate" + }, + "clickToLeadRate": { + "column": "clickToLeadRate" + }, + "consistencyScore": { + "column": "consistencyScore" + }, + "createdAt": { + "column": "createdAt" + }, + "customerDataSharingEnabledAt": { + "column": "customerDataSharingEnabledAt" + }, + "daysSinceLastConversion": { + "column": "daysSinceLastConversion" + }, + "discountId": { + "column": "discountId" + }, + "earningsPerClick": { + "column": "earningsPerClick" + }, + "groupId": { + "column": "groupId" + }, + "groupMoveDisabledAt": { + "column": "groupMoveDisabledAt" + }, + "id": { + "column": "id" + }, + "lastConversionAt": { + "column": "lastConversionAt" + }, + "leadRewardId": { + "column": "leadRewardId" + }, + "leadToConversionRate": { + "column": "leadToConversionRate" + }, + "netRevenue": { + "column": "netRevenue" + }, + "partnerId": { + "column": "partnerId" + }, + "programId": { + "column": "programId" + }, + "returnOnAdSpend": { + "column": "returnOnAdSpend" + }, + "saleRewardId": { + "column": "saleRewardId" + }, + "status": { + "column": "status" + }, + "tenantId": { + "column": "tenantId" + }, + "totalClicks": { + "column": "totalClicks" + }, + "totalCommissions": { + "column": "totalCommissions" + }, + "totalConversions": { + "column": "totalConversions" + }, + "totalLeads": { + "column": "totalLeads" + }, + "totalSaleAmount": { + "column": "totalSaleAmount" + }, + "totalSales": { + "column": "totalSales" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "ProgramEnrollment" + } + }, + "ProgramSimilarity": { + "fields": { + "categorySimilarityScore": { + "nullable": false, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerSimilarityScore": { + "nullable": false, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "performanceSimilarityScore": { + "nullable": false, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "similarProgramId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "similarityScore": { + "nullable": false, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + } + }, + "relations": { + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "similarProgram": { + "cardinality": "N:1", + "on": { + "localFields": [ + "similarProgramId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "categorySimilarityScore": { + "column": "categorySimilarityScore" + }, + "id": { + "column": "id" + }, + "partnerSimilarityScore": { + "column": "partnerSimilarityScore" + }, + "performanceSimilarityScore": { + "column": "performanceSimilarityScore" + }, + "programId": { + "column": "programId" + }, + "similarProgramId": { + "column": "similarProgramId" + }, + "similarityScore": { + "column": "similarityScore" + } + }, + "table": "ProgramSimilarity" + } + }, + "Project": { + "fields": { + "aiLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "aiUsage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "allowedHostnames": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "billingCycleEndsAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "billingCycleStart": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "conversionEnabled": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "defaultProgramId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "domainsLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "dotLinkClaimed": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "fastDirectDebitPayouts": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "foldersLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "foldersUsage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "groupsLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "inviteCode": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "invoicePrefix": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "linksLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "linksUsage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "logo": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "networkInvitesLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "partnersLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "partnersUsage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "paymentFailedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "payoutFee": { + "nullable": false, + "type": { + "codecId": "pg/float8@1", + "kind": "scalar" + } + }, + "payoutFeeWaiverLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "payoutFeeWaiverUsage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "payoutsLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "payoutsUsage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "plan": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "planPeriod": { + "nullable": true, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "planTier": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "publishableKey": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "referralLinkId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "referredSignups": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "shopifyStoreId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "siteVisitTrackingSettings": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "ssoEmailDomain": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "ssoEnforcedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "store": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "stripeConnectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "stripeId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "subscriptionCanceledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "tagsLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalClicks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalLinks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "trialEndsAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "usage": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "usageLastChecked": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "usageLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "usersLimit": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "webhookEnabled": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + } + }, + "relations": { + "customers": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Customer" + }, + "dashboards": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Dashboard" + }, + "defaultDomains": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "DefaultDomains" + }, + "domains": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Domain" + }, + "folders": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Folder" + }, + "installedIntegrations": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "InstalledIntegration" + }, + "integrations": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Integration" + }, + "invites": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "ProjectInvite" + }, + "invoices": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "workspaceId" + ] + }, + "to": "Invoice" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Link" + }, + "oAuthCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "OAuthCode" + }, + "programs": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "workspaceId" + ] + }, + "to": "Program" + }, + "registeredDomains": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "RegisteredDomain" + }, + "restrictedTokens": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "RestrictedToken" + }, + "sentEmails": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "SentEmail" + }, + "tags": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Tag" + }, + "users": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "ProjectUsers" + }, + "utmTemplates": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "UtmTemplate" + }, + "webhooks": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "projectId" + ] + }, + "to": "Webhook" + }, + "yearInReviews": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "workspaceId" + ] + }, + "to": "YearInReview" + } + }, + "storage": { + "fields": { + "aiLimit": { + "column": "aiLimit" + }, + "aiUsage": { + "column": "aiUsage" + }, + "allowedHostnames": { + "column": "allowedHostnames" + }, + "billingCycleEndsAt": { + "column": "billingCycleEndsAt" + }, + "billingCycleStart": { + "column": "billingCycleStart" + }, + "conversionEnabled": { + "column": "conversionEnabled" + }, + "createdAt": { + "column": "createdAt" + }, + "defaultProgramId": { + "column": "defaultProgramId" + }, + "domainsLimit": { + "column": "domainsLimit" + }, + "dotLinkClaimed": { + "column": "dotLinkClaimed" + }, + "fastDirectDebitPayouts": { + "column": "fastDirectDebitPayouts" + }, + "foldersLimit": { + "column": "foldersLimit" + }, + "foldersUsage": { + "column": "foldersUsage" + }, + "groupsLimit": { + "column": "groupsLimit" + }, + "id": { + "column": "id" + }, + "inviteCode": { + "column": "inviteCode" + }, + "invoicePrefix": { + "column": "invoicePrefix" + }, + "linksLimit": { + "column": "linksLimit" + }, + "linksUsage": { + "column": "linksUsage" + }, + "logo": { + "column": "logo" + }, + "name": { + "column": "name" + }, + "networkInvitesLimit": { + "column": "networkInvitesLimit" + }, + "partnersLimit": { + "column": "partnersLimit" + }, + "partnersUsage": { + "column": "partnersUsage" + }, + "paymentFailedAt": { + "column": "paymentFailedAt" + }, + "payoutFee": { + "column": "payoutFee" + }, + "payoutFeeWaiverLimit": { + "column": "payoutFeeWaiverLimit" + }, + "payoutFeeWaiverUsage": { + "column": "payoutFeeWaiverUsage" + }, + "payoutsLimit": { + "column": "payoutsLimit" + }, + "payoutsUsage": { + "column": "payoutsUsage" + }, + "plan": { + "column": "plan" + }, + "planPeriod": { + "column": "planPeriod" + }, + "planTier": { + "column": "planTier" + }, + "publishableKey": { + "column": "publishableKey" + }, + "referralLinkId": { + "column": "referralLinkId" + }, + "referredSignups": { + "column": "referredSignups" + }, + "shopifyStoreId": { + "column": "shopifyStoreId" + }, + "siteVisitTrackingSettings": { + "column": "siteVisitTrackingSettings" + }, + "slug": { + "column": "slug" + }, + "ssoEmailDomain": { + "column": "ssoEmailDomain" + }, + "ssoEnforcedAt": { + "column": "ssoEnforcedAt" + }, + "store": { + "column": "store" + }, + "stripeConnectId": { + "column": "stripeConnectId" + }, + "stripeId": { + "column": "stripeId" + }, + "subscriptionCanceledAt": { + "column": "subscriptionCanceledAt" + }, + "tagsLimit": { + "column": "tagsLimit" + }, + "totalClicks": { + "column": "totalClicks" + }, + "totalLinks": { + "column": "totalLinks" + }, + "trialEndsAt": { + "column": "trialEndsAt" + }, + "updatedAt": { + "column": "updatedAt" + }, + "usage": { + "column": "usage" + }, + "usageLastChecked": { + "column": "usageLastChecked" + }, + "usageLimit": { + "column": "usageLimit" + }, + "usersLimit": { + "column": "usersLimit" + }, + "webhookEnabled": { + "column": "webhookEnabled" + } + }, + "table": "Project" + } + }, + "ProjectInvite": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "email": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "expires": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "role": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + } + }, + "relations": { + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "email": { + "column": "email" + }, + "expires": { + "column": "expires" + }, + "id": { + "column": "id" + }, + "projectId": { + "column": "projectId" + }, + "role": { + "column": "role" + } + }, + "table": "ProjectInvite" + } + }, + "ProjectUsers": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "defaultFolderId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "role": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "workspacePreferences": { + "nullable": true, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + } + }, + "relations": { + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "defaultFolderId": { + "column": "defaultFolderId" + }, + "id": { + "column": "id" + }, + "projectId": { + "column": "projectId" + }, + "role": { + "column": "role" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + }, + "workspacePreferences": { + "column": "workspacePreferences" + } + }, + "table": "ProjectUsers" + } + }, + "RegisteredDomain": { + "fields": { + "autoRenewalDisabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "domainId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "expiresAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "renewalFee": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "slug": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "domain": { + "cardinality": "N:1", + "on": { + "localFields": [ + "domainId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Domain" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "autoRenewalDisabledAt": { + "column": "autoRenewalDisabledAt" + }, + "createdAt": { + "column": "createdAt" + }, + "domainId": { + "column": "domainId" + }, + "expiresAt": { + "column": "expiresAt" + }, + "id": { + "column": "id" + }, + "projectId": { + "column": "projectId" + }, + "renewalFee": { + "column": "renewalFee" + }, + "slug": { + "column": "slug" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "RegisteredDomain" + } + }, + "RestrictedToken": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "expires": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "hashedKey": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "installationId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "lastUsed": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partialKey": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "scopes": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "installedIntegration": { + "cardinality": "N:1", + "on": { + "localFields": [ + "installationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "InstalledIntegration" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "refreshTokens": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "accessTokenId" + ] + }, + "to": "OAuthRefreshToken" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "expires": { + "column": "expires" + }, + "hashedKey": { + "column": "hashedKey" + }, + "id": { + "column": "id" + }, + "installationId": { + "column": "installationId" + }, + "lastUsed": { + "column": "lastUsed" + }, + "name": { + "column": "name" + }, + "partialKey": { + "column": "partialKey" + }, + "projectId": { + "column": "projectId" + }, + "scopes": { + "column": "scopes" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "RestrictedToken" + } + }, + "Reward": { + "fields": { + "amountInCents": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "amountInPercentage": { + "nullable": true, + "type": { + "codecId": "pg/numeric@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "description": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "event": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "maxDuration": { + "nullable": true, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "modifiers": { + "nullable": true, + "type": { + "codecId": "pg/json@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "tooltipDescription": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "clickEnrollments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "clickRewardId" + ] + }, + "to": "ProgramEnrollment" + }, + "commissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "rewardId" + ] + }, + "to": "Commission" + }, + "leadEnrollments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "leadRewardId" + ] + }, + "to": "ProgramEnrollment" + }, + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + }, + "saleEnrollments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "saleRewardId" + ] + }, + "to": "ProgramEnrollment" + } + }, + "storage": { + "fields": { + "amountInCents": { + "column": "amountInCents" + }, + "amountInPercentage": { + "column": "amountInPercentage" + }, + "createdAt": { + "column": "createdAt" + }, + "description": { + "column": "description" + }, + "event": { + "column": "event" + }, + "id": { + "column": "id" + }, + "maxDuration": { + "column": "maxDuration" + }, + "modifiers": { + "column": "modifiers" + }, + "programId": { + "column": "programId" + }, + "tooltipDescription": { + "column": "tooltipDescription" + }, + "type": { + "column": "type" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Reward" + } + }, + "SentEmail": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "projectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "type": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "projectId": { + "column": "projectId" + }, + "type": { + "column": "type" + } + }, + "table": "SentEmail" + } + }, + "Session": { + "fields": { + "expires": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "sessionToken": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "expires": { + "column": "expires" + }, + "id": { + "column": "id" + }, + "sessionToken": { + "column": "sessionToken" + }, + "userId": { + "column": "userId" + } + }, + "table": "Session" + } + }, + "Tag": { + "fields": { + "color": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "tagId" + ] + }, + "to": "LinkTag" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "color": { + "column": "color" + }, + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "projectId": { + "column": "projectId" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Tag" + } + }, + "Token": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "expires": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "hashedKey": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "lastUsed": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "partialKey": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "expires": { + "column": "expires" + }, + "hashedKey": { + "column": "hashedKey" + }, + "id": { + "column": "id" + }, + "lastUsed": { + "column": "lastUsed" + }, + "name": { + "column": "name" + }, + "partialKey": { + "column": "partialKey" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + } + }, + "table": "Token" + } + }, + "User": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "defaultPartnerId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "defaultWorkspace": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "email": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "emailVerified": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "image": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "invalidLoginAttempts": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "isMachine": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "lockedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "name": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "passwordHash": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "sentMail": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "source": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "accounts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Account" + }, + "activityLogs": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "ActivityLog" + }, + "bountySubmissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "BountySubmission" + }, + "createdCommissions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Commission" + }, + "dashboards": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Dashboard" + }, + "folderAccessRequests": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "FolderAccessRequest" + }, + "folders": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "FolderUser" + }, + "fraudAlertsReviewed": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "reviewedById" + ] + }, + "to": "FraudAlert" + }, + "fraudEventGroups": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "FraudEventGroup" + }, + "installedIntegrations": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "InstalledIntegration" + }, + "integrations": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Integration" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Link" + }, + "oAuthCodes": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "OAuthCode" + }, + "partnerComments": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "PartnerComment" + }, + "partners": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "PartnerUser" + }, + "payouts": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Payout" + }, + "programApplications": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "ProgramApplication" + }, + "projects": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "ProjectUsers" + }, + "restrictedTokens": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "RestrictedToken" + }, + "sentMessages": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "senderUserId" + ] + }, + "to": "Message" + }, + "sessions": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Session" + }, + "tokens": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "Token" + }, + "utmTemplates": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "userId" + ] + }, + "to": "UtmTemplate" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "defaultPartnerId": { + "column": "defaultPartnerId" + }, + "defaultWorkspace": { + "column": "defaultWorkspace" + }, + "email": { + "column": "email" + }, + "emailVerified": { + "column": "emailVerified" + }, + "id": { + "column": "id" + }, + "image": { + "column": "image" + }, + "invalidLoginAttempts": { + "column": "invalidLoginAttempts" + }, + "isMachine": { + "column": "isMachine" + }, + "lockedAt": { + "column": "lockedAt" + }, + "name": { + "column": "name" + }, + "passwordHash": { + "column": "passwordHash" + }, + "sentMail": { + "column": "sentMail" + }, + "source": { + "column": "source" + } + }, + "table": "User" + } + }, + "UserNotificationPreferences": { + "fields": { + "dubLinks": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "dubPartners": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "partnerAccount": { + "nullable": false, + "type": { + "codecId": "pg/bool@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "dubLinks": { + "column": "dubLinks" + }, + "dubPartners": { + "column": "dubPartners" + }, + "id": { + "column": "id" + }, + "partnerAccount": { + "column": "partnerAccount" + }, + "userId": { + "column": "userId" + } + }, + "table": "UserNotificationPreferences" + } + }, + "UtmTemplate": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "ref": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "userId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_campaign": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_content": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_medium": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_source": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "utm_term": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + }, + "user": { + "cardinality": "N:1", + "on": { + "localFields": [ + "userId" + ], + "targetFields": [ + "id" + ] + }, + "to": "User" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "projectId": { + "column": "projectId" + }, + "ref": { + "column": "ref" + }, + "updatedAt": { + "column": "updatedAt" + }, + "userId": { + "column": "userId" + }, + "utm_campaign": { + "column": "utm_campaign" + }, + "utm_content": { + "column": "utm_content" + }, + "utm_medium": { + "column": "utm_medium" + }, + "utm_source": { + "column": "utm_source" + }, + "utm_term": { + "column": "utm_term" + } + }, + "table": "UtmTemplate" + } + }, + "VerificationToken": { + "fields": { + "expires": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "identifier": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "token": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": {}, + "storage": { + "fields": { + "expires": { + "column": "expires" + }, + "id": { + "column": "id" + }, + "identifier": { + "column": "identifier" + }, + "token": { + "column": "token" + } + }, + "table": "VerificationToken" + } + }, + "Webhook": { + "fields": { + "consecutiveFailures": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "disabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "installationId": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "lastFailedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "name": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "projectId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "receiver": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "secret": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "triggers": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + }, + "url": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": { + "installedIntegration": { + "cardinality": "N:1", + "on": { + "localFields": [ + "installationId" + ], + "targetFields": [ + "id" + ] + }, + "to": "InstalledIntegration" + }, + "links": { + "cardinality": "1:N", + "on": { + "localFields": [ + "id" + ], + "targetFields": [ + "webhookId" + ] + }, + "to": "LinkWebhook" + }, + "project": { + "cardinality": "N:1", + "on": { + "localFields": [ + "projectId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "consecutiveFailures": { + "column": "consecutiveFailures" + }, + "createdAt": { + "column": "createdAt" + }, + "disabledAt": { + "column": "disabledAt" + }, + "id": { + "column": "id" + }, + "installationId": { + "column": "installationId" + }, + "lastFailedAt": { + "column": "lastFailedAt" + }, + "name": { + "column": "name" + }, + "projectId": { + "column": "projectId" + }, + "receiver": { + "column": "receiver" + }, + "secret": { + "column": "secret" + }, + "triggers": { + "column": "triggers" + }, + "updatedAt": { + "column": "updatedAt" + }, + "url": { + "column": "url" + } + }, + "table": "Webhook" + } + }, + "Workflow": { + "fields": { + "actions": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "disabledAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "name": { + "nullable": true, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "programId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "trigger": { + "nullable": false, + "type": { + "codecId": "pg/enum@1", + "kind": "scalar" + } + }, + "triggerConditions": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "updatedAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamptz@1", + "kind": "scalar" + } + } + }, + "relations": { + "program": { + "cardinality": "N:1", + "on": { + "localFields": [ + "programId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Program" + } + }, + "storage": { + "fields": { + "actions": { + "column": "actions" + }, + "createdAt": { + "column": "createdAt" + }, + "disabledAt": { + "column": "disabledAt" + }, + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "programId": { + "column": "programId" + }, + "trigger": { + "column": "trigger" + }, + "triggerConditions": { + "column": "triggerConditions" + }, + "updatedAt": { + "column": "updatedAt" + } + }, + "table": "Workflow" + } + }, + "YearInReview": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "id": { + "nullable": false, + "type": { + "codecId": "sql/char@1", + "kind": "scalar", + "typeParams": { + "length": 24 + } + } + }, + "sentAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "topCountries": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "topLinks": { + "nullable": false, + "type": { + "codecId": "pg/jsonb@1", + "kind": "scalar" + } + }, + "totalClicks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "totalLinks": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "workspaceId": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + }, + "year": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + } + }, + "relations": { + "workspace": { + "cardinality": "N:1", + "on": { + "localFields": [ + "workspaceId" + ], + "targetFields": [ + "id" + ] + }, + "to": "Project" + } + }, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "id": { + "column": "id" + }, + "sentAt": { + "column": "sentAt" + }, + "topCountries": { + "column": "topCountries" + }, + "topLinks": { + "column": "topLinks" + }, + "totalClicks": { + "column": "totalClicks" + }, + "totalLinks": { + "column": "totalLinks" + }, + "workspaceId": { + "column": "workspaceId" + }, + "year": { + "column": "year" + } + }, + "table": "YearInReview" + } + }, + "jackson_index": { + "fields": { + "id": { + "nullable": false, + "type": { + "codecId": "pg/int4@1", + "kind": "scalar" + } + }, + "key": { + "nullable": false, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "storeKey": { + "nullable": false, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + } + }, + "relations": {}, + "storage": { + "fields": { + "id": { + "column": "id" + }, + "key": { + "column": "key" + }, + "storeKey": { + "column": "storeKey" + } + }, + "table": "jackson_index" + } + }, + "jackson_store": { + "fields": { + "createdAt": { + "nullable": false, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "iv": { + "nullable": true, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "key": { + "nullable": false, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "modifiedAt": { + "nullable": true, + "type": { + "codecId": "pg/timestamp@1", + "kind": "scalar" + } + }, + "namespace": { + "nullable": true, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "tag": { + "nullable": true, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + }, + "value": { + "nullable": false, + "type": { + "codecId": "pg/text@1", + "kind": "scalar" + } + } + }, + "relations": {}, + "storage": { + "fields": { + "createdAt": { + "column": "createdAt" + }, + "iv": { + "column": "iv" + }, + "key": { + "column": "key" + }, + "modifiedAt": { + "column": "modifiedAt" + }, + "namespace": { + "column": "namespace" + }, + "tag": { + "column": "tag" + }, + "value": { + "column": "value" + } + }, + "table": "jackson_store" + } + }, + "jackson_ttl": { + "fields": { + "expiresAt": { + "nullable": false, + "type": { + "codecId": "pg/int8@1", + "kind": "scalar" + } + }, + "key": { + "nullable": false, + "type": { + "codecId": "sql/varchar@1", + "kind": "scalar" + } + } + }, + "relations": {}, + "storage": { + "fields": { + "expiresAt": { + "column": "expiresAt" + }, + "key": { + "column": "key" + } + }, + "table": "jackson_ttl" + } + } + }, + "storage": { + "storageHash": "sha256:d5955b49f64edc75fda048b1ea4739cd32c093276785e3dec5ceefdc0dff3ba8", + "tables": { + "Account": { + "columns": { + "access_token": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "expires_at": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "id_token": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "provider": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "providerAccountId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "refresh_token": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "refresh_token_expires_in": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "scope": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "session_state": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "token_type": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "type": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "provider", + "providerAccountId" + ] + } + ] + }, + "ActivityLog": { + "columns": { + "action": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "batchId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "changeSet": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "parentResourceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "parentResourceType": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "resourceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "resourceType": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "workspaceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "resourceType", + "resourceId" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "Bounty": { + "columns": { + "archivedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "endsAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "maxSubmissions": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 1 + }, + "nativeType": "int4", + "nullable": false + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "performanceScope": { + "codecId": "pg/enum@1", + "nativeType": "BountyPerformanceScope", + "nullable": true, + "typeRef": "BountyPerformanceScope" + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "rewardAmount": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "rewardDescription": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "socialMetricsLastSyncedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "startsAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "submissionFrequency": { + "codecId": "pg/enum@1", + "nativeType": "BountySubmissionFrequency", + "nullable": true, + "typeRef": "BountySubmissionFrequency" + }, + "submissionRequirements": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "submissionsOpenAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "BountyType", + "nullable": false, + "typeRef": "BountyType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "workflowId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "workflowId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Workflow" + } + } + ], + "indexes": [ + { + "columns": [ + "programId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "workflowId" + ] + } + ] + }, + "BountyGroup": { + "columns": { + "bountyId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "groupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + } + }, + "foreignKeys": [ + { + "columns": [ + "bountyId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Bounty" + } + }, + { + "columns": [ + "groupId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "PartnerGroup" + } + } + ], + "indexes": [ + { + "columns": [ + "groupId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "bountyId", + "groupId" + ] + } + ] + }, + "BountySubmission": { + "columns": { + "bountyId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "commissionId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "completedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "files": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "performanceCount": { + "codecId": "pg/int8@1", + "nativeType": "int8", + "nullable": true + }, + "periodNumber": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 1 + }, + "nativeType": "int4", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "rejectionNote": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "rejectionReason": { + "codecId": "pg/enum@1", + "nativeType": "BountySubmissionRejectionReason", + "nullable": true, + "typeRef": "BountySubmissionRejectionReason" + }, + "reviewedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "socialMetricCount": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "socialMetricsLastSyncedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "draft" + }, + "nativeType": "BountySubmissionStatus", + "nullable": false, + "typeRef": "BountySubmissionStatus" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "urls": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "bountyId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Bounty" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "commissionId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Commission" + } + }, + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "userId" + ] + }, + { + "columns": [ + "status" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "commissionId" + ] + }, + { + "columns": [ + "bountyId", + "partnerId", + "periodNumber" + ] + } + ] + }, + "Campaign": { + "columns": { + "bodyJson": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "from": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "preview": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "qstashMessageId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "scheduledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "draft" + }, + "nativeType": "CampaignStatus", + "nullable": false, + "typeRef": "CampaignStatus" + }, + "subject": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "CampaignType", + "nullable": false, + "typeRef": "CampaignType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "workflowId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "workflowId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Workflow" + } + } + ], + "indexes": [ + { + "columns": [ + "programId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "workflowId" + ] + }, + { + "columns": [ + "qstashMessageId" + ] + } + ] + }, + "CampaignGroup": { + "columns": { + "campaignId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "groupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + } + }, + "foreignKeys": [ + { + "columns": [ + "campaignId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Campaign" + } + }, + { + "columns": [ + "groupId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "PartnerGroup" + } + } + ], + "indexes": [ + { + "columns": [ + "groupId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "campaignId", + "groupId" + ] + } + ] + }, + "Commission": { + "columns": { + "amount": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "currency": { + "codecId": "pg/text@1", + "default": { + "kind": "literal", + "value": "usd" + }, + "nativeType": "text", + "nullable": false + }, + "customerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "earnings": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "eventId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "invoiceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "payoutId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "quantity": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "rewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "CommissionStatus", + "nullable": false, + "typeRef": "CommissionStatus" + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "CommissionType", + "nullable": false, + "typeRef": "CommissionType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + }, + { + "columns": [ + "payoutId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Payout" + } + }, + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "customerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Customer" + } + }, + { + "columns": [ + "rewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "earnings", + "programId", + "partnerId", + "status" + ] + }, + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "programId", + "status", + "createdAt", + "amount", + "earnings" + ] + }, + { + "columns": [ + "createdAt", + "status", + "programId", + "earnings" + ] + }, + { + "columns": [ + "partnerId", + "customerId" + ] + }, + { + "columns": [ + "payoutId" + ] + }, + { + "columns": [ + "customerId" + ] + }, + { + "columns": [ + "linkId" + ] + }, + { + "columns": [ + "status" + ] + }, + { + "columns": [ + "rewardId" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "eventId" + ] + }, + { + "columns": [ + "invoiceId", + "programId" + ] + } + ] + }, + "Customer": { + "columns": { + "avatar": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "clickId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "clickedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "country": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "externalId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "firstSaleAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "projectConnectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "saleAmount": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "sales": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "stripeCustomerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "subscriptionCanceledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId", + "email" + ] + }, + { + "columns": [ + "projectId", + "createdAt" + ] + }, + { + "columns": [ + "projectId", + "saleAmount" + ] + }, + { + "columns": [ + "projectId", + "firstSaleAt" + ] + }, + { + "columns": [ + "projectId", + "subscriptionCanceledAt" + ] + }, + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "linkId" + ] + }, + { + "columns": [ + "country" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "stripeCustomerId" + ] + }, + { + "columns": [ + "projectId", + "externalId" + ] + }, + { + "columns": [ + "projectConnectId", + "externalId" + ] + } + ] + }, + "Dashboard": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "doIndex": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "folderId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "password": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "showConversions": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "folderId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Folder" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "linkId" + ] + }, + { + "columns": [ + "folderId" + ] + } + ] + }, + "DefaultDomains": { + "columns": { + "amznid": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "callink": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "chatgpt": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "dubsh": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "figpage": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "ggllink": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "gitnew": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "loooooooong": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "sptifi": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "projectId" + ] + } + ] + }, + "Discount": { + "columns": { + "amount": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "autoProvisionEnabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "couponId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "couponTestId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "maxDuration": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "provider": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "stripe" + }, + "nativeType": "DiscountProvider", + "nullable": false, + "typeRef": "DiscountProvider" + }, + "type": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "percentage" + }, + "nativeType": "RewardStructure", + "nullable": false, + "typeRef": "RewardStructure" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [ + { + "columns": [ + "programId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "DiscountCode": { + "columns": { + "code": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "discountId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "discountId" + ], + "constraint": true, + "index": true, + "onDelete": "setNull", + "references": { + "columns": [ + "id" + ], + "table": "Discount" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "discountId" + ] + }, + { + "columns": [ + "partnerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "linkId" + ] + }, + { + "columns": [ + "programId", + "code" + ] + } + ] + }, + "DiscoveredPartner": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "ignoredAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "invitedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "messagedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "starredAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + } + ], + "indexes": [ + { + "columns": [ + "partnerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "programId", + "partnerId" + ] + } + ] + }, + "Domain": { + "columns": { + "appleAppSiteAssociation": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "archived": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "assetLinks": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "deepviewData": { + "codecId": "pg/jsonb@1", + "default": { + "kind": "literal", + "value": "{}" + }, + "nativeType": "jsonb", + "nullable": true + }, + "expiredUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "lastChecked": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "linkRetentionDays": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "logo": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "notFoundUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "placeholder": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "primary": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "verified": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "lastChecked" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "slug" + ] + } + ] + }, + "EmailDomain": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "lastChecked": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "resendDomainId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "EmailDomainStatus", + "nullable": false, + "typeRef": "EmailDomainStatus" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "workspaceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [ + { + "columns": [ + "lastChecked" + ] + }, + { + "columns": [ + "programId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "slug" + ] + }, + { + "columns": [ + "resendDomainId" + ] + } + ] + }, + "EmailVerificationToken": { + "columns": { + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "identifier": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "token": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "token" + ] + }, + { + "columns": [ + "identifier", + "token" + ] + } + ] + }, + "Folder": { + "columns": { + "accessLevel": { + "codecId": "pg/enum@1", + "nativeType": "FolderAccessLevel", + "nullable": true, + "typeRef": "FolderAccessLevel" + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "type": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "default" + }, + "nativeType": "FolderType", + "nullable": false, + "typeRef": "FolderType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "name", + "projectId" + ] + } + ] + }, + "FolderAccessRequest": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "folderId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "folderId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Folder" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "folderId", + "userId" + ] + } + ] + }, + "FolderUser": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "folderId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "role": { + "codecId": "pg/enum@1", + "nativeType": "FolderUserRole", + "nullable": true, + "typeRef": "FolderUserRole" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "folderId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Folder" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "folderId", + "userId" + ] + } + ] + }, + "FraudAlert": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "reason": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "reviewNote": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "reviewedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "reviewedById": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "FraudAlertStatus", + "nullable": false, + "typeRef": "FraudAlertStatus" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "reviewedById" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + } + ], + "indexes": [ + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "status" + ] + }, + { + "columns": [ + "createdAt" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "FraudEvent": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "customerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "eventId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "fraudEventGroupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "hash": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "metadata": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "sourceProgramId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "fraudEventGroupId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "FraudEventGroup" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "customerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Customer" + } + }, + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "sourceProgramId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId", + "customerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "customerId" + ] + }, + { + "columns": [ + "linkId" + ] + }, + { + "columns": [ + "eventId" + ] + }, + { + "columns": [ + "hash" + ] + }, + { + "columns": [ + "sourceProgramId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "FraudEventGroup": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "eventCount": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "lastEventAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "resolutionReason": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "resolvedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "FraudEventStatus", + "nullable": false, + "typeRef": "FraudEventStatus" + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "FraudRuleType", + "nullable": false, + "typeRef": "FraudRuleType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId", + "type", + "status" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "FraudRule": { + "columns": { + "config": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "disabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "FraudRuleType", + "nullable": false, + "typeRef": "FraudRuleType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "programId", + "type" + ] + } + ] + }, + "InstalledIntegration": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "credentials": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "integrationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "settings": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "integrationId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Integration" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "integrationId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "userId", + "integrationId", + "projectId" + ] + } + ] + }, + "Integration": { + "columns": { + "category": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "comingSoon": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "developer": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "guideUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "installUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "logo": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "readme": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "screenshots": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "verified": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "website": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "setNull", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "slug" + ] + } + ] + }, + "Invoice": { + "columns": { + "amount": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "externalAmount": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "failedAttempts": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "failedReason": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "fee": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "number": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "paidAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "paymentMethod": { + "codecId": "pg/enum@1", + "nativeType": "PaymentMethod", + "nullable": true, + "typeRef": "PaymentMethod" + }, + "payoutMode": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "internal" + }, + "nativeType": "ProgramPayoutMode", + "nullable": false, + "typeRef": "ProgramPayoutMode" + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "receiptUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "registeredDomains": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "processing" + }, + "nativeType": "InvoiceStatus", + "nullable": false, + "typeRef": "InvoiceStatus" + }, + "stripeChargeMetadata": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "total": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "type": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "partnerPayout" + }, + "nativeType": "InvoiceType", + "nullable": false, + "typeRef": "InvoiceType" + }, + "workspaceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "workspaceId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "programId" + ] + }, + { + "columns": [ + "workspaceId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "number" + ] + } + ] + }, + "Link": { + "columns": { + "android": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "archived": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "clicks": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "comments": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "conversions": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": true, + "typeRef": "VarChar280" + }, + "disabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "doIndex": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "domain": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "expiredUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "expiresAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "externalId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "folderId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "geo": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "image": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "ios": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "key": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "lastClicked": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "lastConversionAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "lastLeadAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "leads": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "linkRetentionCleanupDisabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "partnerGroupDefaultLinkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "password": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "proxy": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "publicStats": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "rewrite": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "saleAmount": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "sales": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "shortLink": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": false, + "typeRef": "VarChar400" + }, + "tenantId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "testCompletedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "testStartedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "testVariants": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "title": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "trackConversion": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "url": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_campaign": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_content": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_medium": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_source": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_term": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "video": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "folderId" + ], + "constraint": true, + "index": true, + "onDelete": "setNull", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Folder" + } + }, + { + "columns": [ + "domain" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "slug" + ], + "table": "Domain" + } + }, + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + }, + { + "columns": [ + "partnerGroupDefaultLinkId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "PartnerGroupDefaultLink" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId", + "tenantId" + ] + }, + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "projectId", + "folderId", + "archived", + "createdAt" + ] + }, + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "domain", + "createdAt" + ] + }, + { + "columns": [ + "folderId" + ] + }, + { + "columns": [ + "userId" + ] + }, + { + "columns": [ + "partnerGroupDefaultLinkId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "shortLink" + ] + }, + { + "columns": [ + "domain", + "key" + ] + }, + { + "columns": [ + "projectId", + "externalId" + ] + } + ] + }, + "LinkTag": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "tagId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "tagId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Tag" + } + } + ], + "indexes": [ + { + "columns": [ + "tagId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "linkId", + "tagId" + ] + } + ] + }, + "LinkWebhook": { + "columns": { + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "webhookId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "linkId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Link" + } + }, + { + "columns": [ + "webhookId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Webhook" + } + } + ], + "indexes": [ + { + "columns": [ + "webhookId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "linkId", + "webhookId" + ] + } + ] + }, + "Message": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "readInApp": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "readInEmail": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "senderPartnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "senderUserId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "subject": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "text": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "type": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "direct" + }, + "nativeType": "MessageType", + "nullable": false, + "typeRef": "MessageType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + }, + { + "columns": [ + "senderUserId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "senderPartnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "senderPartnerId" + ] + }, + { + "columns": [ + "senderUserId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "NotificationEmail": { + "columns": { + "bouncedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "bountyId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "campaignId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "deliveredAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "emailId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "messageId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "openedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "recipientUserId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "NotificationEmailType", + "nullable": false, + "typeRef": "NotificationEmailType" + } + }, + "foreignKeys": [ + { + "columns": [ + "messageId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Message" + } + }, + { + "columns": [ + "bountyId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Bounty" + } + }, + { + "columns": [ + "campaignId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Campaign" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [ + { + "columns": [ + "type" + ] + }, + { + "columns": [ + "messageId" + ] + }, + { + "columns": [ + "bountyId" + ] + }, + { + "columns": [ + "campaignId" + ] + }, + { + "columns": [ + "partnerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "emailId" + ] + } + ] + }, + "NotificationPreference": { + "columns": { + "domainConfigurationUpdates": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "fraudEventsSummary": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "linkUsageSummary": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "newBountySubmitted": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "newMessageFromPartner": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "newPartnerApplication": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "newPartnerSale": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "pendingApplicationsSummary": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "projectUserId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectUserId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "ProjectUsers" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "projectUserId" + ] + } + ] + }, + "OAuthApp": { + "columns": { + "clientId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "hashedClientSecret": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "integrationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partialClientSecret": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "pkce": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "redirectUris": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "integrationId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Integration" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "integrationId" + ] + }, + { + "columns": [ + "clientId" + ] + } + ] + }, + "OAuthCode": { + "columns": { + "clientId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "code": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "codeChallenge": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "codeChallengeMethod": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "expiresAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "redirectUri": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "scopes": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "clientId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "clientId" + ], + "table": "OAuthApp" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "clientId" + ] + }, + { + "columns": [ + "userId" + ] + }, + { + "columns": [ + "projectId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "code" + ] + } + ] + }, + "OAuthRefreshToken": { + "columns": { + "accessTokenId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "expiresAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "hashedRefreshToken": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "installationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "accessTokenId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "RestrictedToken" + } + }, + { + "columns": [ + "installationId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "InstalledIntegration" + } + } + ], + "indexes": [ + { + "columns": [ + "installationId" + ] + }, + { + "columns": [ + "accessTokenId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "hashedRefreshToken" + ] + } + ] + }, + "Partner": { + "columns": { + "changeHistoryLog": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "companyName": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "connectPayoutsLastRemindedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "country": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "cryptoWalletAddress": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "defaultPayoutMethod": { + "codecId": "pg/enum@1", + "nativeType": "PartnerPayoutMethod", + "nullable": true, + "typeRef": "PartnerPayoutMethod" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "discoverableAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "identityVerificationStatus": { + "codecId": "pg/enum@1", + "nativeType": "IdentityVerificationStatus", + "nullable": true, + "typeRef": "IdentityVerificationStatus" + }, + "identityVerifiedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "image": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "invoiceSettings": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "monthlyTraffic": { + "codecId": "pg/enum@1", + "nativeType": "MonthlyTraffic", + "nullable": true, + "typeRef": "MonthlyTraffic" + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "payoutMethodHash": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "payoutsEnabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "paypalEmail": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "profileType": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "individual" + }, + "nativeType": "PartnerProfileType", + "nullable": false, + "typeRef": "PartnerProfileType" + }, + "referredByPartnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "stripeConnectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "stripeRecipientId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "trustedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "username": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "veriffMetadata": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "veriffSessionId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [], + "indexes": [ + { + "columns": [ + "country" + ] + }, + { + "columns": [ + "discoverableAt" + ] + }, + { + "columns": [ + "trustedAt" + ] + }, + { + "columns": [ + "payoutMethodHash" + ] + }, + { + "columns": [ + "cryptoWalletAddress" + ] + }, + { + "columns": [ + "identityVerifiedAt" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "username" + ] + }, + { + "columns": [ + "email" + ] + }, + { + "columns": [ + "veriffSessionId" + ] + }, + { + "columns": [ + "paypalEmail" + ] + }, + { + "columns": [ + "stripeConnectId" + ] + }, + { + "columns": [ + "stripeRecipientId" + ] + } + ] + }, + "PartnerComment": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "text": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "createdAt" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "PartnerGroup": { + "columns": { + "additionalLinks": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "applicationFormData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "applicationFormPublishedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "autoApprovePartnersEnabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "brandColor": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "clickRewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "color": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "discountId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "holdingPeriodDays": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "landerData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "landerPublishedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "leadRewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "linkStructure": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "short" + }, + "nativeType": "PartnerLinkStructure", + "nullable": false, + "typeRef": "PartnerLinkStructure" + }, + "logo": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "maxPartnerLinks": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "saleRewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "utmTemplateId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "wordmark": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "workflowId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "clickRewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "leadRewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "saleRewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "discountId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Discount" + } + }, + { + "columns": [ + "workflowId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Workflow" + } + }, + { + "columns": [ + "utmTemplateId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "UtmTemplate" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "clickRewardId" + ] + }, + { + "columns": [ + "leadRewardId" + ] + }, + { + "columns": [ + "saleRewardId" + ] + }, + { + "columns": [ + "discountId" + ] + }, + { + "columns": [ + "workflowId" + ] + }, + { + "columns": [ + "utmTemplateId" + ] + }, + { + "columns": [ + "programId", + "slug" + ] + } + ] + }, + "PartnerGroupDefaultLink": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "domain": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "groupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "url": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "groupId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "PartnerGroup" + } + } + ], + "indexes": [ + { + "columns": [ + "programId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "groupId", + "url" + ] + } + ] + }, + "PartnerIndustryInterest": { + "columns": { + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "industryInterest": { + "codecId": "pg/enum@1", + "nativeType": "IndustryInterest", + "nullable": false, + "typeRef": "IndustryInterest" + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "partnerId", + "industryInterest" + ] + } + ] + }, + "PartnerInvite": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "role": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "member" + }, + "nativeType": "PartnerRole", + "nullable": false, + "typeRef": "PartnerRole" + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [ + { + "columns": [ + "partnerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "email", + "partnerId" + ] + } + ] + }, + "PartnerNotificationPreferences": { + "columns": { + "applicationApproved": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "commissionCreated": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "connectPayoutReminder": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "marketingCampaign": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "monthlyProgramSummary": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "newMessageFromProgram": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "partnerUserId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerUserId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "PartnerUser" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "partnerUserId" + ] + } + ] + }, + "PartnerPlatform": { + "columns": { + "avatarUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "identifier": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "lastCheckedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "metadata": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "platformId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "posts": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "subscribers": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "type": { + "codecId": "pg/enum@1", + "nativeType": "PlatformType", + "nullable": false, + "typeRef": "PlatformType" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "verifiedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "views": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [ + { + "columns": [ + "type" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "partnerId", + "type" + ] + } + ] + }, + "PartnerPreferredEarningStructure": { + "columns": { + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "preferredEarningStructure": { + "codecId": "pg/enum@1", + "nativeType": "PreferredEarningStructure", + "nullable": false, + "typeRef": "PreferredEarningStructure" + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "partnerId", + "preferredEarningStructure" + ] + } + ] + }, + "PartnerReferral": { + "columns": { + "company": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "customerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "formData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "ReferralStatus", + "nullable": false, + "typeRef": "ReferralStatus" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + }, + { + "columns": [ + "customerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Customer" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "customerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "PartnerRewind": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "sentAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "totalClicks": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "totalEarnings": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "totalLeads": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "totalRevenue": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "year": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "partnerId", + "year" + ] + } + ] + }, + "PartnerSalesChannel": { + "columns": { + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "salesChannel": { + "codecId": "pg/enum@1", + "nativeType": "SalesChannel", + "nullable": false, + "typeRef": "SalesChannel" + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "partnerId", + "salesChannel" + ] + } + ] + }, + "PartnerUser": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "role": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "member" + }, + "nativeType": "PartnerRole", + "nullable": false, + "typeRef": "PartnerRole" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [ + { + "columns": [ + "partnerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "userId", + "partnerId" + ] + } + ] + }, + "PasswordResetToken": { + "columns": { + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "identifier": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "token": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "token" + ] + }, + { + "columns": [ + "identifier", + "token" + ] + } + ] + }, + "Payout": { + "columns": { + "amount": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "currency": { + "codecId": "pg/text@1", + "default": { + "kind": "literal", + "value": "USD" + }, + "nativeType": "text", + "nullable": false + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "failureReason": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "initiatedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "invoiceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "method": { + "codecId": "pg/enum@1", + "nativeType": "PartnerPayoutMethod", + "nullable": true, + "typeRef": "PartnerPayoutMethod" + }, + "mode": { + "codecId": "pg/enum@1", + "nativeType": "PayoutMode", + "nullable": true, + "typeRef": "PayoutMode" + }, + "paidAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "paypalTransferId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "periodEnd": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "periodStart": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "PayoutStatus", + "nullable": false, + "typeRef": "PayoutStatus" + }, + "stripePayoutId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "stripePayoutTraceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "stripeTransferId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "webhookEventId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId", + "partnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "programId", + "partnerId" + ], + "table": "ProgramEnrollment" + } + }, + { + "columns": [ + "invoiceId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Invoice" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "status" + ] + }, + { + "columns": [ + "programId", + "partnerId" + ] + }, + { + "columns": [ + "partnerId" + ] + }, + { + "columns": [ + "invoiceId" + ] + }, + { + "columns": [ + "status" + ] + }, + { + "columns": [ + "method" + ] + }, + { + "columns": [ + "userId" + ] + }, + { + "columns": [ + "stripePayoutId" + ] + }, + { + "columns": [ + "stripeTransferId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "paypalTransferId" + ] + }, + { + "columns": [ + "webhookEventId" + ] + } + ] + }, + "Postback": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "disabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "receiver": { + "codecId": "pg/enum@1", + "nativeType": "PostbackReceiver", + "nullable": false, + "typeRef": "PostbackReceiver" + }, + "secret": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "triggers": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "url": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + } + ], + "indexes": [ + { + "columns": [ + "partnerId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "Program": { + "columns": { + "addedToMarketplaceAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "applicationRequirements": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "deactivatedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "defaultFolderId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "defaultGroupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "domain": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "embedData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "featuredOnMarketplaceAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "helpUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "inviteEmailData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "logo": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "marketplaceHeaderImage": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "marketplaceRanking": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 2147483647 + }, + "nativeType": "int4", + "nullable": false + }, + "messagingEnabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "minPayoutAmount": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partnerNetworkEnabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "payoutMode": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "internal" + }, + "nativeType": "ProgramPayoutMode", + "nullable": false, + "typeRef": "ProgramPayoutMode" + }, + "primaryRewardEvent": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "sale" + }, + "nativeType": "EventType", + "nullable": false, + "typeRef": "EventType" + }, + "referralFormData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "resources": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "startedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "supportEmail": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "termsUrl": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "url": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "workspaceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "workspaceId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "domain" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "slug" + ], + "table": "Domain" + } + } + ], + "indexes": [ + { + "columns": [ + "workspaceId" + ] + }, + { + "columns": [ + "addedToMarketplaceAt" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "slug" + ] + }, + { + "columns": [ + "domain" + ] + } + ] + }, + "ProgramApplication": { + "columns": { + "country": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "formData": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "groupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "instagram": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "linkedin": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "rejectionNote": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "rejectionReason": { + "codecId": "pg/enum@1", + "nativeType": "ProgramApplicationRejectionReason", + "nullable": true, + "typeRef": "ProgramApplicationRejectionReason" + }, + "reviewedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "tiktok": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "twitter": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "website": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "youtube": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "groupId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "PartnerGroup" + } + }, + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "programId" + ] + }, + { + "columns": [ + "groupId" + ] + }, + { + "columns": [ + "email" + ] + }, + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "ProgramApplicationEvent": { + "columns": { + "approvedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "country": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "metadata": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programApplicationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "referralSource": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "referredByPartnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "rejectedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "startedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "submittedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "visitedAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + } + }, + "foreignKeys": [ + { + "columns": [ + "referredByPartnerId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programApplicationId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "ProgramApplication" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "visitedAt" + ] + }, + { + "columns": [ + "programId", + "startedAt" + ] + }, + { + "columns": [ + "programId", + "submittedAt" + ] + }, + { + "columns": [ + "programId", + "approvedAt" + ] + }, + { + "columns": [ + "programId", + "country" + ] + }, + { + "columns": [ + "programId", + "referralSource" + ] + }, + { + "columns": [ + "programId", + "referredByPartnerId" + ] + }, + { + "columns": [ + "referredByPartnerId" + ] + }, + { + "columns": [ + "programApplicationId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "programId", + "partnerId" + ] + } + ] + }, + "ProgramCategory": { + "columns": { + "category": { + "codecId": "pg/enum@1", + "nativeType": "Category", + "nullable": false, + "typeRef": "Category" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "programId", + "category" + ] + } + ] + }, + "ProgramEnrollment": { + "columns": { + "applicationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "averageLifetimeValue": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": true + }, + "bannedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "bannedReason": { + "codecId": "pg/enum@1", + "nativeType": "PartnerBannedReason", + "nullable": true, + "typeRef": "PartnerBannedReason" + }, + "clickRewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "clickToConversionRate": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": true + }, + "clickToLeadRate": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": true + }, + "consistencyScore": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "customerDataSharingEnabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "daysSinceLastConversion": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "discountId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "earningsPerClick": { + "codecId": "pg/float8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "float8", + "nullable": false + }, + "groupId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "groupMoveDisabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "lastConversionAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "leadRewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "leadToConversionRate": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": true + }, + "netRevenue": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "partnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "returnOnAdSpend": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": true + }, + "saleRewardId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "status": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "pending" + }, + "nativeType": "ProgramEnrollmentStatus", + "nullable": false, + "typeRef": "ProgramEnrollmentStatus" + }, + "tenantId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "totalClicks": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "totalCommissions": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "totalConversions": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "totalLeads": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "totalSaleAmount": { + "codecId": "pg/int8@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int8", + "nullable": false + }, + "totalSales": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "partnerId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Partner" + } + }, + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "groupId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "PartnerGroup" + } + }, + { + "columns": [ + "applicationId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "ProgramApplication" + } + }, + { + "columns": [ + "clickRewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "leadRewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "saleRewardId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Reward" + } + }, + { + "columns": [ + "discountId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Discount" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "status", + "totalClicks" + ] + }, + { + "columns": [ + "programId", + "status", + "totalLeads" + ] + }, + { + "columns": [ + "programId", + "status", + "totalConversions" + ] + }, + { + "columns": [ + "programId", + "status", + "totalSaleAmount" + ] + }, + { + "columns": [ + "programId", + "status", + "totalCommissions" + ] + }, + { + "columns": [ + "programId", + "status", + "netRevenue" + ] + }, + { + "columns": [ + "programId", + "status", + "earningsPerClick" + ] + }, + { + "columns": [ + "programId", + "status", + "averageLifetimeValue" + ] + }, + { + "columns": [ + "programId", + "status", + "clickToLeadRate" + ] + }, + { + "columns": [ + "programId", + "status", + "clickToConversionRate" + ] + }, + { + "columns": [ + "programId", + "status", + "leadToConversionRate" + ] + }, + { + "columns": [ + "programId", + "status", + "returnOnAdSpend" + ] + }, + { + "columns": [ + "programId", + "groupId" + ] + }, + { + "columns": [ + "groupId", + "status" + ] + }, + { + "columns": [ + "clickRewardId" + ] + }, + { + "columns": [ + "leadRewardId" + ] + }, + { + "columns": [ + "saleRewardId" + ] + }, + { + "columns": [ + "discountId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "applicationId" + ] + }, + { + "columns": [ + "partnerId", + "programId" + ] + }, + { + "columns": [ + "tenantId", + "programId" + ] + } + ] + }, + "ProgramSimilarity": { + "columns": { + "categorySimilarityScore": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerSimilarityScore": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": false + }, + "performanceSimilarityScore": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": false + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "similarProgramId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "similarityScore": { + "codecId": "pg/float8@1", + "nativeType": "float8", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + }, + { + "columns": [ + "similarProgramId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "similarityScore" + ] + }, + { + "columns": [ + "similarProgramId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "programId", + "similarProgramId" + ] + } + ] + }, + "Project": { + "columns": { + "aiLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 10 + }, + "nativeType": "int4", + "nullable": false + }, + "aiUsage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "allowedHostnames": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "billingCycleEndsAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "billingCycleStart": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "conversionEnabled": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "defaultProgramId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "domainsLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 3 + }, + "nativeType": "int4", + "nullable": false + }, + "dotLinkClaimed": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "fastDirectDebitPayouts": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "foldersLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "foldersUsage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "groupsLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "inviteCode": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "invoicePrefix": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "linksLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 25 + }, + "nativeType": "int4", + "nullable": false + }, + "linksUsage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "logo": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "networkInvitesLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "partnersLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "partnersUsage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "paymentFailedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "payoutFee": { + "codecId": "pg/float8@1", + "default": { + "kind": "literal", + "value": 0.05 + }, + "nativeType": "float8", + "nullable": false + }, + "payoutFeeWaiverLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "payoutFeeWaiverUsage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "payoutsLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "payoutsUsage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "plan": { + "codecId": "pg/text@1", + "default": { + "kind": "literal", + "value": "free" + }, + "nativeType": "text", + "nullable": false + }, + "planPeriod": { + "codecId": "pg/enum@1", + "nativeType": "PlanPeriod", + "nullable": true, + "typeRef": "PlanPeriod" + }, + "planTier": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 1 + }, + "nativeType": "int4", + "nullable": false + }, + "publishableKey": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "referralLinkId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "referredSignups": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "shopifyStoreId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "siteVisitTrackingSettings": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "ssoEmailDomain": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "ssoEnforcedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "store": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + }, + "stripeConnectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "stripeId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "subscriptionCanceledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "tagsLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 5 + }, + "nativeType": "int4", + "nullable": false + }, + "totalClicks": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "totalLinks": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "trialEndsAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "usage": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "usageLastChecked": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "usageLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 1000 + }, + "nativeType": "int4", + "nullable": false + }, + "usersLimit": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 1 + }, + "nativeType": "int4", + "nullable": false + }, + "webhookEnabled": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + } + }, + "foreignKeys": [], + "indexes": [ + { + "columns": [ + "usageLastChecked" + ] + }, + { + "columns": [ + "trialEndsAt" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "slug" + ] + }, + { + "columns": [ + "inviteCode" + ] + }, + { + "columns": [ + "defaultProgramId" + ] + }, + { + "columns": [ + "stripeId" + ] + }, + { + "columns": [ + "invoicePrefix" + ] + }, + { + "columns": [ + "stripeConnectId" + ] + }, + { + "columns": [ + "shopifyStoreId" + ] + }, + { + "columns": [ + "referralLinkId" + ] + }, + { + "columns": [ + "publishableKey" + ] + }, + { + "columns": [ + "ssoEmailDomain" + ] + } + ] + }, + "ProjectInvite": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "role": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "member" + }, + "nativeType": "WorkspaceRole", + "nullable": false, + "typeRef": "WorkspaceRole" + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "email", + "projectId" + ] + } + ] + }, + "ProjectUsers": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "defaultFolderId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "role": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "member" + }, + "nativeType": "WorkspaceRole", + "nullable": false, + "typeRef": "WorkspaceRole" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "workspacePreferences": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "userId", + "projectId" + ] + } + ] + }, + "RegisteredDomain": { + "columns": { + "autoRenewalDisabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "domainId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "expiresAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "renewalFee": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 1200 + }, + "nativeType": "int4", + "nullable": false + }, + "slug": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "domainId" + ], + "constraint": true, + "index": true, + "onDelete": "setNull", + "references": { + "columns": [ + "id" + ], + "table": "Domain" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "expiresAt" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "domainId" + ] + } + ] + }, + "RestrictedToken": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "hashedKey": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "installationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "lastUsed": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partialKey": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "scopes": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "installationId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "InstalledIntegration" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + }, + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "installationId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "hashedKey" + ] + } + ] + }, + "Reward": { + "columns": { + "amountInCents": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "amountInPercentage": { + "codecId": "pg/numeric@1", + "nativeType": "numeric", + "nullable": true, + "typeRef": "Numeric5p2" + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "description": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "event": { + "codecId": "pg/enum@1", + "nativeType": "EventType", + "nullable": false, + "typeRef": "EventType" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "maxDuration": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": true + }, + "modifiers": { + "codecId": "pg/json@1", + "nativeType": "json", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "tooltipDescription": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "type": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "percentage" + }, + "nativeType": "RewardStructure", + "nullable": false, + "typeRef": "RewardStructure" + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "event" + ] + }, + { + "columns": [ + "event" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "SentEmail": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "type": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "Session": { + "columns": { + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "sessionToken": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "sessionToken" + ] + } + ] + }, + "Tag": { + "columns": { + "color": { + "codecId": "pg/text@1", + "default": { + "kind": "literal", + "value": "blue" + }, + "nativeType": "text", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "name", + "projectId" + ] + } + ] + }, + "Token": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "hashedKey": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "lastUsed": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "partialKey": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "hashedKey" + ] + } + ] + }, + "User": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "defaultPartnerId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "defaultWorkspace": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "email": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "emailVerified": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "image": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "invalidLoginAttempts": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "isMachine": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "lockedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "passwordHash": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "sentMail": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": false + }, + "nativeType": "bool", + "nullable": false + }, + "source": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [], + "indexes": [ + { + "columns": [ + "sentMail" + ] + }, + { + "columns": [ + "source" + ] + }, + { + "columns": [ + "defaultWorkspace" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "email" + ] + } + ] + }, + "UserNotificationPreferences": { + "columns": { + "dubLinks": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "dubPartners": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "partnerAccount": { + "codecId": "pg/bool@1", + "default": { + "kind": "literal", + "value": true + }, + "nativeType": "bool", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "User" + } + } + ], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "userId" + ] + } + ] + }, + "UtmTemplate": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "ref": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "userId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_campaign": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_content": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_medium": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_source": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "utm_term": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + } + }, + "foreignKeys": [ + { + "columns": [ + "userId" + ], + "constraint": true, + "index": true, + "references": { + "columns": [ + "id" + ], + "table": "User" + } + }, + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "onUpdate": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "userId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "projectId", + "name" + ] + } + ] + }, + "VerificationToken": { + "columns": { + "expires": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "identifier": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "token": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [], + "indexes": [], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [ + { + "columns": [ + "token" + ] + }, + { + "columns": [ + "identifier", + "token" + ] + } + ] + }, + "Webhook": { + "columns": { + "consecutiveFailures": { + "codecId": "pg/int4@1", + "default": { + "kind": "literal", + "value": 0 + }, + "nativeType": "int4", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "disabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "installationId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "lastFailedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "projectId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "receiver": { + "codecId": "pg/enum@1", + "default": { + "kind": "literal", + "value": "user" + }, + "nativeType": "WebhookReceiver", + "nullable": false, + "typeRef": "WebhookReceiver" + }, + "secret": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "triggers": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + }, + "url": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "projectId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + }, + { + "columns": [ + "installationId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "InstalledIntegration" + } + } + ], + "indexes": [ + { + "columns": [ + "projectId" + ] + }, + { + "columns": [ + "installationId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "Workflow": { + "columns": { + "actions": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + }, + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "disabledAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "name": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": true + }, + "programId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "trigger": { + "codecId": "pg/enum@1", + "nativeType": "WorkflowTrigger", + "nullable": false, + "typeRef": "WorkflowTrigger" + }, + "triggerConditions": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + }, + "updatedAt": { + "codecId": "pg/timestamptz@1", + "nativeType": "timestamptz", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "programId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Program" + } + } + ], + "indexes": [ + { + "columns": [ + "programId", + "trigger" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "YearInReview": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp3" + }, + "id": { + "codecId": "sql/char@1", + "nativeType": "character", + "nullable": false, + "typeParams": { + "length": 24 + } + }, + "sentAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp3" + }, + "topCountries": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + }, + "topLinks": { + "codecId": "pg/jsonb@1", + "nativeType": "jsonb", + "nullable": false + }, + "totalClicks": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "totalLinks": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + }, + "workspaceId": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + }, + "year": { + "codecId": "pg/int4@1", + "nativeType": "int4", + "nullable": false + } + }, + "foreignKeys": [ + { + "columns": [ + "workspaceId" + ], + "constraint": true, + "index": true, + "onDelete": "cascade", + "references": { + "columns": [ + "id" + ], + "table": "Project" + } + } + ], + "indexes": [ + { + "columns": [ + "workspaceId" + ] + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "jackson_index": { + "columns": { + "id": { + "codecId": "pg/int4@1", + "default": { + "expression": "autoincrement()", + "kind": "function" + }, + "nativeType": "int4", + "nullable": false + }, + "key": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": false, + "typeRef": "VarChar250" + }, + "storeKey": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": false, + "typeRef": "VarChar250" + } + }, + "foreignKeys": [], + "indexes": [ + { + "columns": [ + "key", + "storeKey" + ], + "name": "_jackson_index_key_store" + } + ], + "primaryKey": { + "columns": [ + "id" + ] + }, + "uniques": [] + }, + "jackson_store": { + "columns": { + "createdAt": { + "codecId": "pg/timestamp@1", + "default": { + "expression": "now()", + "kind": "function" + }, + "nativeType": "timestamp", + "nullable": false, + "typeRef": "Timestamp0" + }, + "iv": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": true, + "typeRef": "VarChar64" + }, + "key": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": false, + "typeRef": "VarChar250" + }, + "modifiedAt": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "nullable": true, + "typeRef": "Timestamp0" + }, + "namespace": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": true, + "typeRef": "VarChar64" + }, + "tag": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": true, + "typeRef": "VarChar64" + }, + "value": { + "codecId": "pg/text@1", + "nativeType": "text", + "nullable": false + } + }, + "foreignKeys": [], + "indexes": [ + { + "columns": [ + "namespace" + ], + "name": "_jackson_store_namespace" + } + ], + "primaryKey": { + "columns": [ + "key" + ] + }, + "uniques": [] + }, + "jackson_ttl": { + "columns": { + "expiresAt": { + "codecId": "pg/int8@1", + "nativeType": "int8", + "nullable": false + }, + "key": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "nullable": false, + "typeRef": "VarChar250" + } + }, + "foreignKeys": [], + "indexes": [ + { + "columns": [ + "expiresAt" + ], + "name": "_jackson_ttl_expires_at" + } + ], + "primaryKey": { + "columns": [ + "key" + ] + }, + "uniques": [] + } + }, + "types": { + "BountyPerformanceScope": { + "codecId": "pg/enum@1", + "nativeType": "BountyPerformanceScope", + "typeParams": { + "values": [ + "new", + "lifetime" + ] + } + }, + "BountySubmissionFrequency": { + "codecId": "pg/enum@1", + "nativeType": "BountySubmissionFrequency", + "typeParams": { + "values": [ + "day", + "week", + "month" + ] + } + }, + "BountySubmissionRejectionReason": { + "codecId": "pg/enum@1", + "nativeType": "BountySubmissionRejectionReason", + "typeParams": { + "values": [ + "invalidProof", + "duplicateSubmission", + "outOfTimeWindow", + "didNotMeetCriteria", + "other" + ] + } + }, + "BountySubmissionStatus": { + "codecId": "pg/enum@1", + "nativeType": "BountySubmissionStatus", + "typeParams": { + "values": [ + "draft", + "submitted", + "approved", + "rejected" + ] + } + }, + "BountyType": { + "codecId": "pg/enum@1", + "nativeType": "BountyType", + "typeParams": { + "values": [ + "performance", + "submission" + ] + } + }, + "CampaignStatus": { + "codecId": "pg/enum@1", + "nativeType": "CampaignStatus", + "typeParams": { + "values": [ + "draft", + "active", + "paused", + "scheduled", + "sending", + "sent", + "canceled" + ] + } + }, + "CampaignType": { + "codecId": "pg/enum@1", + "nativeType": "CampaignType", + "typeParams": { + "values": [ + "marketing", + "transactional" + ] + } + }, + "Category": { + "codecId": "pg/enum@1", + "nativeType": "Category", + "typeParams": { + "values": [ + "Artificial_Intelligence", + "Development", + "Design", + "Productivity", + "Finance", + "Marketing", + "Ecommerce", + "Security", + "Education", + "Health", + "Consumer" + ] + } + }, + "CommissionStatus": { + "codecId": "pg/enum@1", + "nativeType": "CommissionStatus", + "typeParams": { + "values": [ + "pending", + "processed", + "paid", + "refunded", + "duplicate", + "fraud", + "canceled" + ] + } + }, + "CommissionType": { + "codecId": "pg/enum@1", + "nativeType": "CommissionType", + "typeParams": { + "values": [ + "click", + "lead", + "sale", + "custom" + ] + } + }, + "DiscountProvider": { + "codecId": "pg/enum@1", + "nativeType": "DiscountProvider", + "typeParams": { + "values": [ + "stripe", + "shopify" + ] + } + }, + "EmailDomainStatus": { + "codecId": "pg/enum@1", + "nativeType": "EmailDomainStatus", + "typeParams": { + "values": [ + "pending", + "verified", + "failed", + "temporary_failure", + "not_started" + ] + } + }, + "EventType": { + "codecId": "pg/enum@1", + "nativeType": "EventType", + "typeParams": { + "values": [ + "click", + "lead", + "sale" + ] + } + }, + "FolderAccessLevel": { + "codecId": "pg/enum@1", + "nativeType": "FolderAccessLevel", + "typeParams": { + "values": [ + "read", + "write" + ] + } + }, + "FolderType": { + "codecId": "pg/enum@1", + "nativeType": "FolderType", + "typeParams": { + "values": [ + "default", + "mega" + ] + } + }, + "FolderUserRole": { + "codecId": "pg/enum@1", + "nativeType": "FolderUserRole", + "typeParams": { + "values": [ + "owner", + "editor", + "viewer" + ] + } + }, + "FraudAlertStatus": { + "codecId": "pg/enum@1", + "nativeType": "FraudAlertStatus", + "typeParams": { + "values": [ + "pending", + "confirmed", + "dismissed" + ] + } + }, + "FraudEventStatus": { + "codecId": "pg/enum@1", + "nativeType": "FraudEventStatus", + "typeParams": { + "values": [ + "pending", + "resolved" + ] + } + }, + "FraudRuleType": { + "codecId": "pg/enum@1", + "nativeType": "FraudRuleType", + "typeParams": { + "values": [ + "customerEmailMatch", + "customerEmailSuspiciousDomain", + "referralSourceBanned", + "paidTrafficDetected", + "partnerCrossProgramBan", + "partnerDuplicateAccount" + ] + } + }, + "IdentityVerificationStatus": { + "codecId": "pg/enum@1", + "nativeType": "IdentityVerificationStatus", + "typeParams": { + "values": [ + "started", + "submitted", + "approved", + "declined", + "resubmissionRequested", + "expired", + "abandoned", + "review" + ] + } + }, + "IndustryInterest": { + "codecId": "pg/enum@1", + "nativeType": "IndustryInterest", + "typeParams": { + "values": [ + "SaaS", + "DevTool", + "AI", + "Creative_And_Design", + "Productivity_Software", + "Marketing", + "Gaming", + "Finance", + "Sales", + "Ecommerce", + "Customer_Service_And_Support", + "Content_Management", + "Human_Resources", + "Security", + "Analytics_And_Data", + "Social_Media", + "Consumer_Tech", + "Education_And_Learning", + "Health_And_Fitness", + "Food_And_Beverage", + "Travel_And_Lifestyle", + "Entertainment_And_Media", + "Sports", + "Science_And_Engineering" + ] + } + }, + "InvoiceStatus": { + "codecId": "pg/enum@1", + "nativeType": "InvoiceStatus", + "typeParams": { + "values": [ + "processing", + "completed", + "failed" + ] + } + }, + "InvoiceType": { + "codecId": "pg/enum@1", + "nativeType": "InvoiceType", + "typeParams": { + "values": [ + "partnerPayout", + "domainRenewal" + ] + } + }, + "JsonData": { + "codecId": "pg/json@1", + "nativeType": "json", + "typeParams": {} + }, + "MessageType": { + "codecId": "pg/enum@1", + "nativeType": "MessageType", + "typeParams": { + "values": [ + "direct", + "campaign" + ] + } + }, + "MonthlyTraffic": { + "codecId": "pg/enum@1", + "nativeType": "MonthlyTraffic", + "typeParams": { + "values": [ + "ZeroToOneThousand", + "OneThousandToTenThousand", + "TenThousandToFiftyThousand", + "FiftyThousandToOneHundredThousand", + "OneHundredThousandPlus" + ] + } + }, + "NotificationEmailType": { + "codecId": "pg/enum@1", + "nativeType": "NotificationEmailType", + "typeParams": { + "values": [ + "Message", + "Bounty", + "Campaign" + ] + } + }, + "Numeric5p2": { + "codecId": "pg/numeric@1", + "nativeType": "numeric", + "typeParams": { + "precision": 5, + "scale": 2 + } + }, + "PartnerBannedReason": { + "codecId": "pg/enum@1", + "nativeType": "PartnerBannedReason", + "typeParams": { + "values": [ + "tos_violation", + "inappropriate_content", + "fake_traffic", + "fraud", + "spam", + "brand_abuse" + ] + } + }, + "PartnerLinkStructure": { + "codecId": "pg/enum@1", + "nativeType": "PartnerLinkStructure", + "typeParams": { + "values": [ + "short", + "query", + "path" + ] + } + }, + "PartnerPayoutMethod": { + "codecId": "pg/enum@1", + "nativeType": "PartnerPayoutMethod", + "typeParams": { + "values": [ + "connect", + "stablecoin", + "paypal" + ] + } + }, + "PartnerProfileType": { + "codecId": "pg/enum@1", + "nativeType": "PartnerProfileType", + "typeParams": { + "values": [ + "individual", + "company" + ] + } + }, + "PartnerRole": { + "codecId": "pg/enum@1", + "nativeType": "PartnerRole", + "typeParams": { + "values": [ + "owner", + "member" + ] + } + }, + "PaymentMethod": { + "codecId": "pg/enum@1", + "nativeType": "PaymentMethod", + "typeParams": { + "values": [ + "card", + "ach", + "ach_fast", + "sepa", + "acss" + ] + } + }, + "PayoutMode": { + "codecId": "pg/enum@1", + "nativeType": "PayoutMode", + "typeParams": { + "values": [ + "internal", + "external" + ] + } + }, + "PayoutStatus": { + "codecId": "pg/enum@1", + "nativeType": "PayoutStatus", + "typeParams": { + "values": [ + "pending", + "processing", + "processed", + "sent", + "completed", + "failed", + "canceled" + ] + } + }, + "PlanPeriod": { + "codecId": "pg/enum@1", + "nativeType": "PlanPeriod", + "typeParams": { + "values": [ + "monthly", + "yearly", + "quarterly", + "biweekly" + ] + } + }, + "PlatformType": { + "codecId": "pg/enum@1", + "nativeType": "PlatformType", + "typeParams": { + "values": [ + "website", + "youtube", + "twitter", + "linkedin", + "instagram", + "tiktok" + ] + } + }, + "PostbackReceiver": { + "codecId": "pg/enum@1", + "nativeType": "PostbackReceiver", + "typeParams": { + "values": [ + "custom", + "slack" + ] + } + }, + "PreferredEarningStructure": { + "codecId": "pg/enum@1", + "nativeType": "PreferredEarningStructure", + "typeParams": { + "values": [ + "Revenue_Share", + "Per_Lead", + "Per_Sale", + "Per_Click", + "One_Time_Payment" + ] + } + }, + "ProgramApplicationRejectionReason": { + "codecId": "pg/enum@1", + "nativeType": "ProgramApplicationRejectionReason", + "typeParams": { + "values": [ + "needsMoreDetail", + "doesNotMeetRequirements", + "notTheRightFit", + "other" + ] + } + }, + "ProgramEnrollmentStatus": { + "codecId": "pg/enum@1", + "nativeType": "ProgramEnrollmentStatus", + "typeParams": { + "values": [ + "pending", + "approved", + "rejected", + "invited", + "declined", + "deactivated", + "banned", + "archived" + ] + } + }, + "ProgramPayoutMode": { + "codecId": "pg/enum@1", + "nativeType": "ProgramPayoutMode", + "typeParams": { + "values": [ + "internal", + "hybrid", + "external" + ] + } + }, + "ReferralStatus": { + "codecId": "pg/enum@1", + "nativeType": "ReferralStatus", + "typeParams": { + "values": [ + "pending", + "qualified", + "meeting", + "negotiation", + "unqualified", + "closedWon", + "closedLost" + ] + } + }, + "RewardStructure": { + "codecId": "pg/enum@1", + "nativeType": "RewardStructure", + "typeParams": { + "values": [ + "percentage", + "flat" + ] + } + }, + "SalesChannel": { + "codecId": "pg/enum@1", + "nativeType": "SalesChannel", + "typeParams": { + "values": [ + "Blogs", + "Coupons", + "Direct_Reselling", + "Newsletters", + "Social_Media", + "Events", + "Company_Referrals" + ] + } + }, + "Timestamp0": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "typeParams": {} + }, + "Timestamp3": { + "codecId": "pg/timestamp@1", + "nativeType": "timestamp", + "typeParams": { + "precision": 3 + } + }, + "VarChar250": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "typeParams": { + "length": 250 + } + }, + "VarChar280": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "typeParams": { + "length": 280 + } + }, + "VarChar400": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "typeParams": { + "length": 400 + } + }, + "VarChar64": { + "codecId": "sql/varchar@1", + "nativeType": "character varying", + "typeParams": { + "length": 64 + } + }, + "WebhookReceiver": { + "codecId": "pg/enum@1", + "nativeType": "WebhookReceiver", + "typeParams": { + "values": [ + "user", + "zapier", + "make", + "slack", + "segment" + ] + } + }, + "WorkflowTrigger": { + "codecId": "pg/enum@1", + "nativeType": "WorkflowTrigger", + "typeParams": { + "values": [ + "partnerEnrolled", + "partnerMetricsUpdated", + "clickRecorded", + "commissionEarned", + "leadRecorded", + "saleRecorded" + ] + } + }, + "WorkspaceRole": { + "codecId": "pg/enum@1", + "nativeType": "WorkspaceRole", + "typeParams": { + "values": [ + "owner", + "member", + "viewer", + "billing" + ] + } + } + } + }, + "execution": { + "executionHash": "sha256:01c316b3ac6cf360e880db365d1c2c4b0c432d821b9611bac3314dc36a53b240", + "mutations": { + "defaults": [ + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Account" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ActivityLog" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Bounty" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Bounty" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "BountyGroup" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "BountySubmission" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "BountySubmission" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Campaign" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Campaign" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "CampaignGroup" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Commission" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Commission" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Customer" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Customer" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Dashboard" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Dashboard" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "DefaultDomains" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Discount" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Discount" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "DiscountCode" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "DiscountCode" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "DiscoveredPartner" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "DiscoveredPartner" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Domain" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Domain" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "EmailDomain" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "EmailDomain" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "EmailVerificationToken" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Folder" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Folder" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "FolderAccessRequest" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "FolderUser" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "FolderUser" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "FraudAlert" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "FraudAlert" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "FraudEvent" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "FraudEvent" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "FraudEventGroup" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "FraudEventGroup" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "FraudRule" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "FraudRule" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "InstalledIntegration" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "InstalledIntegration" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Integration" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Integration" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Invoice" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Link" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Link" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "LinkTag" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "LinkTag" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "LinkWebhook" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Message" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Message" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "NotificationEmail" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "NotificationPreference" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "OAuthApp" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "OAuthCode" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "OAuthRefreshToken" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Partner" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Partner" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerComment" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "PartnerComment" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerGroup" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "PartnerGroup" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerGroupDefaultLink" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "PartnerGroupDefaultLink" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerIndustryInterest" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerInvite" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerNotificationPreferences" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerPlatform" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "PartnerPlatform" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerPreferredEarningStructure" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerReferral" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "PartnerReferral" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerRewind" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerSalesChannel" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PartnerUser" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "PartnerUser" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "PasswordResetToken" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Payout" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Payout" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Postback" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Postback" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Program" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Program" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProgramApplication" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "ProgramApplication" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProgramApplicationEvent" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProgramCategory" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProgramEnrollment" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "ProgramEnrollment" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProgramSimilarity" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Project" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Project" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProjectInvite" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "ProjectUsers" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "ProjectUsers" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "RegisteredDomain" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "RegisteredDomain" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "RestrictedToken" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "RestrictedToken" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Reward" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Reward" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "SentEmail" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Session" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Tag" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Tag" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Token" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Token" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "User" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "UserNotificationPreferences" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "UtmTemplate" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "UtmTemplate" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "VerificationToken" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Webhook" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Webhook" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "Workflow" + } + }, + { + "onCreate": { + "id": "timestampNow", + "kind": "generator" + }, + "onUpdate": { + "id": "timestampNow", + "kind": "generator" + }, + "ref": { + "column": "updatedAt", + "table": "Workflow" + } + }, + { + "onCreate": { + "id": "cuid2", + "kind": "generator" + }, + "ref": { + "column": "id", + "table": "YearInReview" + } + } + ] + } + }, + "capabilities": { + "postgres": { + "jsonAgg": true, + "lateral": true, + "limit": true, + "orderBy": true, + "returning": true + }, + "sql": { + "defaultInInsert": true, + "enums": true, + "returning": true + } + }, + "extensionPacks": {}, + "meta": {}, + "_generated": { + "warning": "⚠️ GENERATED FILE - DO NOT EDIT", + "message": "This file is automatically generated by \"prisma-next contract emit\".", + "regenerate": "To regenerate, run: prisma-next contract emit" + } +} diff --git a/packages/prisma/schema/contract.prisma b/packages/prisma/schema/contract.prisma new file mode 100644 index 00000000000..49c9b5d8181 --- /dev/null +++ b/packages/prisma/schema/contract.prisma @@ -0,0 +1,2438 @@ +// Prisma Next PSL contract for the hybrid PostgreSQL port. +// Prisma 6 production runtime continues to use the split schema files in this directory. + +types { + JsonData = Json @db.Json + Numeric5p2 = Decimal @db.Numeric(5, 2) + Timestamp0 = DateTime @db.Timestamp + Timestamp3 = DateTime @db.Timestamp(3) + VarChar64 = String @db.VarChar(64) + VarChar250 = String @db.VarChar(250) + VarChar280 = String @db.VarChar(280) + VarChar400 = String @db.VarChar(400) +} + +model User { + id String @id @default(cuid(2)) + name String? + email String? @unique + emailVerified Timestamp3? + image String? + isMachine Boolean @default(false) + createdAt Timestamp3 @default(now()) + + // password & security fields + passwordHash String? + invalidLoginAttempts Int @default(0) + lockedAt Timestamp3? + + // user preferences + defaultWorkspace String? // slug of the user's default workspace + defaultPartnerId String? // the user's default partner ID + + // internal fields + source String? // where the user came from + sentMail Boolean @default(false) + + // relational data + accounts Account[] + sessions Session[] + projects ProjectUsers[] + partners PartnerUser[] + links Link[] + dashboards Dashboard[] + tokens Token[] + restrictedTokens RestrictedToken[] + oAuthCodes OAuthCode[] + integrations Integration[] // Integrations user created in their workspace + installedIntegrations InstalledIntegration[] // Integrations user installed in their workspace + folders FolderUser[] + folderAccessRequests FolderAccessRequest[] + utmTemplates UtmTemplate[] + payouts Payout[] + bountySubmissions BountySubmission[] + programApplications ProgramApplication[] + sentMessages Message[] + partnerComments PartnerComment[] + fraudEventGroups FraudEventGroup[] + fraudAlertsReviewed FraudAlert[] @relation("FraudAlertReviewer") + activityLogs ActivityLog[] + createdCommissions Commission[] + + @@index([sentMail]) + @@index([source]) + @@index([defaultWorkspace]) + + @@map("User") +} + +model Account { + id String @id @default(cuid(2)) + userId String + type String + provider String + providerAccountId String + refresh_token String? + refresh_token_expires_in Int? + access_token String? + expires_at Int? + token_type String? + scope String? + id_token String? + session_state String? + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@unique([provider, providerAccountId]) + @@index([userId]) + + @@map("Account") +} + +model Session { + id String @id @default(cuid(2)) + sessionToken String @unique + userId String + expires Timestamp3 + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@index([userId]) + + @@map("Session") +} + +model ActivityLog { + id String @id @default(cuid(2)) + workspaceId String + programId String + parentResourceType String? + parentResourceId String? + resourceType String + resourceId String + userId String? + action String + description String? + batchId String? + changeSet Json? + createdAt Timestamp3 @default(now()) + + user User? @relation(fields: [userId], references: [id]) + + @@index([resourceType, resourceId]) + @@index([userId]) + + @@map("ActivityLog") +} + +enum ProgramApplicationRejectionReason { + needsMoreDetail + doesNotMeetRequirements + notTheRightFit + other +} + +model ProgramApplication { + id String @id @default(cuid(2)) + programId String + groupId String? + name String + email String + country String? + website String? + youtube String? + twitter String? + linkedin String? + instagram String? + tiktok String? + formData JsonData? + userId String? // user who reviewed the application + rejectionReason ProgramApplicationRejectionReason? + rejectionNote String? + reviewedAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id]) + partnerGroup PartnerGroup? @relation(fields: [groupId], references: [id]) + user User? @relation(fields: [userId], references: [id]) + programApplicationEvents ProgramApplicationEvent[] + + @@index([programId]) + @@index([groupId]) + @@index([email]) + @@index([userId]) + + @@map("ProgramApplication") +} + +model ProgramApplicationEvent { + id String @id @default(cuid(2)) + programId String + + visitedAt Timestamp3 @default(now()) + startedAt Timestamp3? + submittedAt Timestamp3? + approvedAt Timestamp3? + rejectedAt Timestamp3? + + country String? + referralSource String // e.g. company.com, linkedin.com, marketplace, direct + referredByPartnerId String? // pn_xxx – partner ID who referred the application + metadata JsonData? // full URL, ip address, user agent, geo/device data etc. + + programApplicationId String? + partnerId String? + + referredByPartner Partner? @relation(fields: [referredByPartnerId], references: [id]) + application ProgramApplication? @relation(fields: [programApplicationId], references: [id]) + + @@unique([programId, partnerId]) + @@index([programId, visitedAt]) + @@index([programId, startedAt]) + @@index([programId, submittedAt]) + @@index([programId, approvedAt]) + @@index([programId, country]) + @@index([programId, referralSource]) + @@index([programId, referredByPartnerId]) + @@index([referredByPartnerId]) + @@index([programApplicationId]) + + @@map("ProgramApplicationEvent") +} + +enum BountyType { + performance + submission +} + +enum BountyPerformanceScope { + new + lifetime +} + +enum BountySubmissionStatus { + draft + submitted + approved + rejected +} + +enum BountySubmissionRejectionReason { + invalidProof + duplicateSubmission + outOfTimeWindow + didNotMeetCriteria + other +} + +enum BountySubmissionFrequency { + day + week + month +} + +model Bounty { + id String @id @default(cuid(2)) + programId String + workflowId String? @unique + name String + description String? + type BountyType + startsAt Timestamp3 + endsAt Timestamp3? + submissionsOpenAt Timestamp3? + submissionFrequency BountySubmissionFrequency? + maxSubmissions Int @default(1) + rewardAmount Int? + rewardDescription String? + performanceScope BountyPerformanceScope? + submissionRequirements Json? + socialMetricsLastSyncedAt Timestamp3? + archivedAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + submissions BountySubmission[] + groups BountyGroup[] + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + workflow Workflow? @relation(fields: [workflowId], references: [id], onDelete: Cascade) + emails NotificationEmail[] + + @@index([programId]) + + @@map("Bounty") +} + +model BountyGroup { + id String @id @default(cuid(2)) + bountyId String + groupId String + + bounty Bounty @relation(fields: [bountyId], references: [id], onDelete: Cascade) + partnerGroup PartnerGroup @relation(fields: [groupId], references: [id], onDelete: Cascade) + + @@unique([bountyId, groupId]) + @@index([groupId]) + + @@map("BountyGroup") +} + +model BountySubmission { + id String @id @default(cuid(2)) + programId String + partnerId String + bountyId String + performanceCount BigInt? + socialMetricCount Int? + commissionId String? @unique + userId String? + description String? + status BountySubmissionStatus @default("draft") + rejectionReason BountySubmissionRejectionReason? + rejectionNote String? + files Json? + urls Json? + periodNumber Int @default(1) + socialMetricsLastSyncedAt Timestamp3? + completedAt Timestamp3? + reviewedAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + bounty Bounty @relation(fields: [bountyId], references: [id], onDelete: Cascade) + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + commission Commission? @relation(fields: [commissionId], references: [id], onDelete: Cascade) + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + user User? @relation(fields: [userId], references: [id]) + programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId], onDelete: Cascade) + + @@unique([bountyId, partnerId, periodNumber]) + @@index([programId, partnerId]) + @@index([partnerId]) + @@index([userId]) + @@index([status]) + + @@map("BountySubmission") +} + +enum CampaignType { + marketing + transactional +} + +enum CampaignStatus { + draft + + // Transactional + active + paused + + // Marketing + scheduled + sending + sent + canceled +} + +model Campaign { + id String @id @default(cuid(2)) + programId String + workflowId String? @unique + userId String + qstashMessageId String? @unique + type CampaignType + status CampaignStatus @default("draft") + name String + subject String + preview String? + from String? + bodyJson JsonData + scheduledAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + program Program @relation(fields: [programId], references: [id]) + workflow Workflow? @relation(fields: [workflowId], references: [id], onDelete: Cascade) + groups CampaignGroup[] + emails NotificationEmail[] + + @@index([programId]) + + @@map("Campaign") +} + +model CampaignGroup { + id String @id @default(cuid(2)) + campaignId String + groupId String + + campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade) + partnerGroup PartnerGroup @relation(fields: [groupId], references: [id], onDelete: Cascade) + + @@unique([campaignId, groupId]) + @@index([groupId]) + + @@map("CampaignGroup") +} + +model PartnerComment { + id String @id @default(cuid(2)) + programId String + partnerId String + userId String + text String + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@index([programId, partnerId]) + @@index([partnerId]) + @@index([createdAt]) + @@index([userId]) + + @@map("PartnerComment") +} + +enum CommissionStatus { + pending + processed + paid + refunded + duplicate + fraud + canceled +} + +enum CommissionType { + click + lead + sale + custom +} + +model Commission { + id String @id @default(cuid(2)) + programId String + partnerId String + rewardId String? + linkId String? + payoutId String? + invoiceId String? // only for sales (idempotency key, each sale event is associated with a unique invoice) + customerId String? // only for leads and sales + eventId String? @unique // only for leads and sales + description String? + type CommissionType + amount Int // only for sales (amount of the sale event) + quantity Int // only for clicks/leads (quantity of the event) + earnings Int @default(0) // amount earned by the partner + currency String @default("usd") + status CommissionStatus @default("pending") + userId String? // user who created the manual commission + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id]) + partner Partner @relation(fields: [partnerId], references: [id]) + programEnrollment ProgramEnrollment @relation(fields: [programId, partnerId], references: [programId, partnerId]) + payout Payout? @relation(fields: [payoutId], references: [id]) + link Link? @relation(fields: [linkId], references: [id]) + customer Customer? @relation(fields: [customerId], references: [id]) + reward Reward? @relation(fields: [rewardId], references: [id]) + user User? @relation(fields: [userId], references: [id]) + + @@unique([invoiceId, programId]) + @@index([earnings, programId, partnerId, status]) // old index + @@index([programId, partnerId]) // for programEnrollment relation (used in cron/payouts/aggregate-due-commissions) + @@index([programId, status, createdAt, amount, earnings]) // for program/commissions (scoped by programId) + @@index([createdAt, status, programId, earnings]) // for admin/commissions + @@index([partnerId, customerId]) + @@index([payoutId]) + @@index([customerId]) + @@index([linkId]) + @@index([status]) + @@index([rewardId]) + @@index([userId]) + + @@map("Commission") +} + +model Customer { + id String @id @default(cuid(2)) + name String? + email String? + avatar String? + externalId String? + stripeCustomerId String? @unique + + linkId String? + clickId String? + clickedAt Timestamp3? + country String? + + sales Int @default(0) + saleAmount BigInt @default(0) + firstSaleAt Timestamp3? + subscriptionCanceledAt Timestamp3? + + projectId String + projectConnectId String? + + programId String? + partnerId String? + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + project Project @relation(fields: [projectId], references: [id]) + link Link? @relation(fields: [linkId], references: [id]) + program Program? @relation(fields: [programId], references: [id], onDelete: Cascade) + partner Partner? @relation(fields: [partnerId], references: [id], onDelete: Cascade) + programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId]) + commissions Commission[] + fraudEvents FraudEvent[] + referrals PartnerReferral[] + + @@unique([projectId, externalId]) + @@unique([projectConnectId, externalId]) + @@index([projectId, email]) + @@index([projectId, createdAt]) + @@index([projectId, saleAmount]) + @@index([projectId, firstSaleAt]) + @@index([projectId, subscriptionCanceledAt]) + @@index([programId, partnerId]) + @@index([partnerId]) + @@index([linkId]) + @@index([country]) + + @@map("Customer") +} + +model Dashboard { + id String @id @default(cuid(2)) + + link Link? @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade) + linkId String? @unique + + folder Folder? @relation(fields: [folderId], references: [id], onUpdate: Cascade, onDelete: Cascade) + folderId String? @unique + + // Project that the share link belongs to + project Project? @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade) + projectId String? + + // User who created the shared dashboard + user User? @relation(fields: [userId], references: [id], onUpdate: Cascade, onDelete: Cascade) + userId String? + + // additional link configurations + doIndex Boolean @default(false) // whether to index the share link on Google or not + password String? // password to access the share link + showConversions Boolean @default(false) + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + @@index([projectId]) + @@index([userId]) + + @@map("Dashboard") +} + +enum DiscountProvider { + stripe + shopify +} + +model Discount { + id String @id @default(cuid(2)) + programId String + amount Int @default(0) + type RewardStructure @default("percentage") + maxDuration Int? // in months (0 -> one-time purchase, 1, 3, 6, 12, 18, 24, 36, 48 -> months, null -> lifetime) + description String? + couponId String? + couponTestId String? + autoProvisionEnabledAt Timestamp3? // Auto create discount codes for partners when they join the group + provider DiscountProvider @default("stripe") + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + programEnrollments ProgramEnrollment[] + program Program @relation("ProgramDiscounts", fields: [programId], references: [id]) + discountCodes DiscountCode[] + + @@index([programId]) + + @@map("Discount") +} + +model DiscountCode { + id String @id @default(cuid(2)) + code String + programId String + discountId String? + partnerId String + linkId String @unique + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + discount Discount? @relation(fields: [discountId], references: [id], onDelete: SetNull) + partner Partner @relation(fields: [partnerId], references: [id]) + link Link @relation(fields: [linkId], references: [id]) + programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId]) + + @@unique([programId, code]) + @@index([programId, partnerId]) + @@index([discountId]) + @@index([partnerId]) + + @@map("DiscountCode") +} + +model Domain { + id String @id @default(cuid(2)) + slug String @unique + verified Boolean @default(false) + placeholder String? + expiredUrl String? // URL to redirect to for expired links + notFoundUrl String? // URL to redirect to for links that don't exist + primary Boolean @default(false) + archived Boolean @default(false) + lastChecked Timestamp3 @default(now()) + logo String? + appleAppSiteAssociation Json? + assetLinks Json? + deepviewData Json? @default("{}") + + linkRetentionDays Int? // default is null (links are retained forever) + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + projectId String? + project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade) + links Link[] + + @@index([projectId]) + @@index([lastChecked]) + + @@map("Domain") +} + +model RegisteredDomain { + id String @id @default(cuid(2)) + slug String + projectId String + domainId String? @unique + autoRenewalDisabledAt Timestamp3? + renewalFee Int @default(1200) // $12 + expiresAt Timestamp3 + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + project Project @relation(fields: [projectId], references: [id]) + domain Domain? @relation(fields: [domainId], references: [id], onDelete: SetNull) + + @@index([projectId]) + @@index([expiresAt]) + + @@map("RegisteredDomain") +} + +model DefaultDomains { + id String @id @default(cuid(2)) + dubsh Boolean @default(true) + chatgpt Boolean @default(true) + sptifi Boolean @default(true) + gitnew Boolean @default(true) + callink Boolean @default(true) + amznid Boolean @default(true) + ggllink Boolean @default(true) + figpage Boolean @default(true) + loooooooong Boolean @default(false) + projectId String @unique + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + + @@map("DefaultDomains") +} + +enum EmailDomainStatus { + pending + verified + failed + temporary_failure + not_started +} + +model EmailDomain { + id String @id @default(cuid(2)) + workspaceId String + programId String + slug String @unique + status EmailDomainStatus @default("pending") + resendDomainId String? @unique + lastChecked Timestamp3 @default(now()) + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + + @@index([lastChecked]) + @@index([programId]) + + @@map("EmailDomain") +} + +enum FolderType { + default + mega +} + +enum FolderAccessLevel { + read // can view the links + write // can view and move links +} + +enum FolderUserRole { + owner // full control + editor // can move links to the folder + viewer // can view the links +} + +model Folder { + id String @id @default(cuid(2)) + name String + description String? + projectId String + type FolderType @default("default") + accessLevel FolderAccessLevel? // Access level of the folder within the workspace + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + project Project @relation(fields: [projectId], references: [id]) + links Link[] + users FolderUser[] + accessRequests FolderAccessRequest[] + + @@unique([name, projectId]) + @@index([projectId]) + + @@map("Folder") +} + +model FolderUser { + id String @id @default(cuid(2)) + folderId String + userId String + role FolderUserRole? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@unique([folderId, userId]) + @@index([userId]) + + @@map("FolderUser") +} + +model FolderAccessRequest { + id String @id @default(cuid(2)) + folderId String + userId String + createdAt Timestamp3 @default(now()) + + folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@unique([folderId, userId]) + @@index([userId]) + + @@map("FolderAccessRequest") +} + +enum FraudEventStatus { + pending + resolved +} + +enum FraudRuleType { + customerEmailMatch + customerEmailSuspiciousDomain + referralSourceBanned + paidTrafficDetected + partnerCrossProgramBan // Cross-program ban from other programs + partnerDuplicateAccount // Duplicate identity with other partners +} + +model FraudRule { + id String @id @default(cuid(2)) + programId String + type FraudRuleType + config JsonData? + disabledAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program? @relation(fields: [programId], references: [id], onDelete: Cascade) + + @@unique([programId, type]) + + @@map("FraudRule") +} + +model FraudEventGroup { + id String @id @default(cuid(2)) + programId String + partnerId String + type FraudRuleType + lastEventAt Timestamp3? + eventCount Int @default(0) + userId String? + resolutionReason String? + resolvedAt Timestamp3? + status FraudEventStatus @default("pending") + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + programEnrollment ProgramEnrollment @relation(fields: [programId, partnerId], references: [programId, partnerId], onDelete: Cascade) + fraudEvents FraudEvent[] + user User? @relation(fields: [userId], references: [id]) + + @@index([programId, partnerId, type, status]) + @@index([partnerId]) + @@index([userId]) + + @@map("FraudEventGroup") +} + +model FraudEvent { + id String @id @default(cuid(2)) + fraudEventGroupId String + programId String + partnerId String + linkId String? + customerId String? + eventId String? + sourceProgramId String? // The program that originated the ban/fraud report + hash String + metadata JsonData? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + fraudEventGroup FraudEventGroup @relation(fields: [fraudEventGroupId], references: [id], onDelete: Cascade) + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + customer Customer? @relation(fields: [customerId], references: [id]) + link Link? @relation(fields: [linkId], references: [id]) + sourceProgram Program? @relation("SourceFraudEvents", fields: [sourceProgramId], references: [id]) + + @@index([programId, partnerId, customerId]) + @@index([partnerId]) + @@index([customerId]) + @@index([linkId]) + @@index([eventId]) + @@index([hash]) + @@index([sourceProgramId]) + + @@map("FraudEvent") +} + +enum FraudAlertStatus { + pending + confirmed + dismissed +} + +model FraudAlert { + id String @id @default(cuid(2)) + partnerId String + programId String + reason String + status FraudAlertStatus @default("pending") + reviewedById String? + reviewedAt Timestamp3? + reviewNote String? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + reviewedBy User? @relation("FraudAlertReviewer", fields: [reviewedById], references: [id]) + programEnrollment ProgramEnrollment @relation(fields: [programId, partnerId], references: [programId, partnerId], onDelete: Cascade) + + @@index([partnerId]) + @@index([status]) + @@index([createdAt]) + + @@map("FraudAlert") +} + +enum PartnerLinkStructure { + short + query + path +} + +model PartnerGroup { + id String @id @default(cuid(2)) + programId String + name String + slug String + color String? + clickRewardId String? @unique + leadRewardId String? @unique + saleRewardId String? @unique + discountId String? @unique + linkStructure PartnerLinkStructure @default("short") + additionalLinks JsonData? + maxPartnerLinks Int @default(0) + applicationFormData JsonData? + applicationFormPublishedAt Timestamp3? + landerData JsonData? + landerPublishedAt Timestamp3? + logo String? + wordmark String? + brandColor String? + holdingPeriodDays Int @default(0) // number of days to wait before earnings are added to a payout + autoApprovePartnersEnabledAt Timestamp3? + workflowId String? @unique + utmTemplateId String? @unique + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + clickReward Reward? @relation("ClickReward", fields: [clickRewardId], references: [id]) + leadReward Reward? @relation("LeadReward", fields: [leadRewardId], references: [id]) + saleReward Reward? @relation("SaleReward", fields: [saleRewardId], references: [id]) + discount Discount? @relation(fields: [discountId], references: [id]) + partners ProgramEnrollment[] + applications ProgramApplication[] + bounties BountyGroup[] + campaigns CampaignGroup[] + workflow Workflow? @relation(fields: [workflowId], references: [id]) + utmTemplate UtmTemplate? @relation(fields: [utmTemplateId], references: [id]) + partnerGroupDefaultLinks PartnerGroupDefaultLink[] + + @@unique([programId, slug]) + + @@map("PartnerGroup") +} + +model PartnerGroupDefaultLink { + id String @id @default(cuid(2)) + programId String + groupId String + domain String + url String + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + partnerGroup PartnerGroup @relation(fields: [groupId], references: [id], onDelete: Cascade) + links Link[] + + @@unique([groupId, url]) + @@index([programId]) + + @@map("PartnerGroupDefaultLink") +} + +model Integration { + id String @id @default(cuid(2)) + userId String? + projectId String + name String + slug String @unique + description String? + readme String? + developer String + website String + logo String? + screenshots Json? + verified Boolean @default(false) + installUrl String? + guideUrl String? + category String? + comingSoon Boolean @default(false) + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + user User? @relation(fields: [userId], references: [id], onDelete: SetNull) + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + installations InstalledIntegration[] + + @@index([projectId]) + @@index([userId]) + + @@map("Integration") +} + +model InstalledIntegration { + id String @id @default(cuid(2)) + userId String // user who installed the integration + integrationId String // integration that was installed + projectId String // workspace where integration was installed + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + credentials Json? + settings Json? + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + integration Integration @relation(fields: [integrationId], references: [id], onDelete: Cascade) + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + refreshTokens OAuthRefreshToken[] + accessTokens RestrictedToken[] + webhooks Webhook[] + + @@unique([userId, integrationId, projectId]) + @@index([projectId]) + @@index([integrationId]) + + @@map("InstalledIntegration") +} + +enum InvoiceStatus { + processing + completed + failed +} + +enum InvoiceType { + partnerPayout + domainRenewal +} + +enum PaymentMethod { + card + ach + ach_fast + sepa + acss +} + +model Invoice { + id String @id @default(cuid(2)) + programId String? + workspaceId String + number String? @unique // This starts with the customer's unique invoicePrefix + status InvoiceStatus @default("processing") + type InvoiceType @default("partnerPayout") + payoutMode ProgramPayoutMode @default("internal") + paymentMethod PaymentMethod? + amount Int @default(0) // amount in usd cents + fee Int @default(0) // fee in usd cents + total Int @default(0) // amount + fee in usd cents + externalAmount Int @default(0) // amount in usd cents for external payouts + receiptUrl String? + failedReason String? + registeredDomains JsonData? // Array of RegisteredDomain + stripeChargeMetadata JsonData? // Stripe charge metadata + failedAttempts Int @default(0) // number of failed attempts to charge the invoice + createdAt Timestamp3 @default(now()) + paidAt Timestamp3? + + payouts Payout[] + program Program? @relation(fields: [programId], references: [id]) + workspace Project @relation(fields: [workspaceId], references: [id]) + + @@index([programId]) + @@index([workspaceId]) + + @@map("Invoice") +} + +model jackson_index { + id Int @id @default(autoincrement()) + key VarChar250 + storeKey VarChar250 + + @@index([key, storeKey], map: "_jackson_index_key_store") + + @@map("jackson_index") +} + +model jackson_store { + key VarChar250 @id + value String + iv VarChar64? + tag VarChar64? + namespace VarChar64? + createdAt Timestamp0 @default(now()) + modifiedAt Timestamp0? + + @@index([namespace], map: "_jackson_store_namespace") + + @@map("jackson_store") +} + +model jackson_ttl { + key VarChar250 @id + expiresAt BigInt + + @@index([expiresAt], map: "_jackson_ttl_expires_at") + + @@map("jackson_ttl") +} + +model Link { + id String @id @default(cuid(2)) + domain String // domain of the link (e.g. dub.sh) – also stored on Redis + key String // key of the link (e.g. /github) – also stored on Redis + url String // target url (e.g. https://github.com/dubinc/dub) – also stored on Redis + shortLink VarChar400 @unique // new column for the full short link + archived Boolean @default(false) // whether the link is archived or not + expiresAt Timestamp3? // when the link expires – stored on Redis via ttl + expiredUrl String? // URL to redirect the user to when the link is expired + disabledAt Timestamp3? // when the link was disabled + password String? // password to access the link + trackConversion Boolean @default(false) // whether to track conversions or not + proxy Boolean @default(false) // Proxy to use custom OG tags (stored on redis) – if false, will use OG tags from target url + title String? // OG title for the link (e.g. Dub - open-source link attribution platform) + description VarChar280? // OG description for the link (e.g. The modern link attribution platform for short links, conversion tracking, and affiliate programs.) + image String? // OG image for the link (e.g. https://d.to/og) + video String? // OG video for the link + + // UTM parameters + utm_source String? // UTM source for the link (e.g. youtube.com) + utm_medium String? // UTM medium for the link (e.g. social) + utm_campaign String? // UTM campaign for the link (e.g. summer-sale) + utm_term String? // UTM term for the link (e.g. dub) + utm_content String? // UTM content for the link (e.g. description) + + rewrite Boolean @default(false) // whether to rewrite the link or not + + linkRetentionCleanupDisabledAt Timestamp3? // When link retention cleanup (see domain.linkRetentionDays) was explicitly disabled + doIndex Boolean @default(false) // we don't index short links by default + + // Custom device targeting + ios String? // custom link for iOS devices + android String? // custom link for Android devices + geo JsonData? // custom link for specific countries + + // A/B Testing + testVariants JsonData? + testStartedAt Timestamp3? // When tests were started + testCompletedAt Timestamp3? // When tests were or will be completed + + // User who created the link + user User? @relation(fields: [userId], references: [id]) + userId String? + + // Project that the link belongs to + project Project? @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade) + projectId String? + + folderId String? + folder Folder? @relation(fields: [folderId], references: [id], onUpdate: Cascade, onDelete: SetNull) + + // External & tenant IDs (for API usage + multi-tenancy) + externalId String? + tenantId String? + + publicStats Boolean @default(false) // whether to show public stats or not + clicks Int @default(0) // number of clicks + leads Int @default(0) // number of leads + conversions Int @default(0) // number of leads that converted to sales + sales Int @default(0) // number of sales (includes recurring sales) + saleAmount BigInt @default(0) // total revenue from sales (in cents) + + lastClicked Timestamp3? // when the link was last clicked + lastLeadAt Timestamp3? // when the link last brought in a new lead + lastConversionAt Timestamp3? // when the link last brought in a new conversion + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + // Link short domain + shortDomain Domain @relation(fields: [domain], references: [slug]) + + // Link tags + tags LinkTag[] + + // Link webhooks + webhooks LinkWebhook[] + + // Comments on the particular shortlink + comments String? + + programId String? + program Program? @relation(fields: [programId], references: [id]) + partnerId String? + partner Partner? @relation(fields: [partnerId], references: [id]) + programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId]) + partnerGroupDefaultLinkId String? + partnerGroupDefaultLink PartnerGroupDefaultLink? @relation(fields: [partnerGroupDefaultLinkId], references: [id]) + customers Customer[] + commissions Commission[] + fraudEvents FraudEvent[] + + @@unique([domain, key]) // for getting a link by domain and key + @@unique([projectId, externalId]) // for getting a link by externalId + @@index([projectId, tenantId]) // for filtering by tenantId + @@index([projectId]) // Postgres URL lookup index lives in postdeploy SQL + @@index([projectId, folderId, archived, createdAt]) // most getLinksForWorkspace queries + @@index([programId, partnerId]) // for getting a referral link (programId + partnerId) + @@index([partnerId]) // for getting links by partnerId + @@index([domain, createdAt]) // for bulk link deletion workflows (by domain) + deleting old short-lived links + @@index([folderId]) // used in /api/folders + @@index([userId]) // for relation to User table, used in /api/cron/cleanup/e2e-tests too + @@index([partnerGroupDefaultLinkId]) + + @@map("Link") +} + +enum MessageType { + direct + campaign +} + +model Message { + id String @id @default(cuid(2)) + programId String + partnerId String + + senderUserId String + senderPartnerId String? // Populated only if the sender is a partner + + type MessageType @default("direct") + subject String? // Only for Campaign + text String + + readInApp Timestamp3? + readInEmail Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + partner Partner @relation("PartnerMessages", fields: [partnerId], references: [id], onDelete: Cascade) + programEnrollment ProgramEnrollment @relation(fields: [programId, partnerId], references: [programId, partnerId]) + senderUser User @relation(fields: [senderUserId], references: [id], onDelete: Cascade) + senderPartner Partner? @relation("SenderPartner", fields: [senderPartnerId], references: [id], onDelete: Cascade) + emails NotificationEmail[] + + @@index([programId, partnerId]) + @@index([partnerId]) + @@index([senderPartnerId]) + @@index([senderUserId]) + + @@map("Message") +} + +model YearInReview { + id String @id @default(cuid(2)) + year Int + + totalLinks Int + totalClicks Int + topLinks Json + topCountries Json + + workspaceId String + workspace Project @relation(fields: [workspaceId], references: [id], onDelete: Cascade) + + createdAt Timestamp3 @default(now()) + sentAt Timestamp3? + + @@index([workspaceId]) + + @@map("YearInReview") +} + +model PartnerRewind { + id String @id @default(cuid(2)) + year Int + + totalClicks Int + totalLeads Int + totalRevenue Int + totalEarnings Int + + partnerId String + partner Partner @relation(fields: [partnerId], references: [id]) + + createdAt Timestamp3 @default(now()) + sentAt Timestamp3? + + @@unique([partnerId, year]) + + @@map("PartnerRewind") +} + +enum Category { + Artificial_Intelligence + Development + Design + Productivity + Finance + Marketing + Ecommerce + Security + Education + Health + Consumer + // Prediction_Markets +} + +model ProgramCategory { + id String @id @default(cuid(2)) + programId String + category Category + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + + @@unique([programId, category]) + + @@map("ProgramCategory") +} + +model ProgramSimilarity { + id String @id @default(cuid(2)) + programId String + similarProgramId String + similarityScore Float + categorySimilarityScore Float + partnerSimilarityScore Float + performanceSimilarityScore Float + + program Program @relation("ProgramSimilarities", fields: [programId], references: [id], onDelete: Cascade) + similarProgram Program @relation("SimilarProgram", fields: [similarProgramId], references: [id], onDelete: Cascade) + + @@unique([programId, similarProgramId]) + @@index([programId, similarityScore]) + @@index([similarProgramId]) + + @@map("ProgramSimilarity") +} + +model DiscoveredPartner { + id String @id @default(cuid(2)) + programId String + partnerId String + + starredAt Timestamp3? + ignoredAt Timestamp3? + invitedAt Timestamp3? + messagedAt Timestamp3? + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + programEnrollment ProgramEnrollment? @relation(fields: [programId, partnerId], references: [programId, partnerId]) + + @@unique([programId, partnerId]) + @@index([partnerId]) + + @@map("DiscoveredPartner") +} + +// TODO: remove after we refactor all partner.industryInterests to use programCategory instead +enum IndustryInterest { + SaaS + DevTool + AI + Creative_And_Design + Productivity_Software + Marketing + Gaming + Finance + Sales + Ecommerce + Customer_Service_And_Support + Content_Management + Human_Resources + Security + Analytics_And_Data + Social_Media + Consumer_Tech + Education_And_Learning + Health_And_Fitness + Food_And_Beverage + Travel_And_Lifestyle + Entertainment_And_Media + Sports + Science_And_Engineering +} + +enum NotificationEmailType { + Message + Bounty + Campaign +} + +model NotificationEmail { + id String @id @default(cuid(2)) + emailId String @unique // Resend email id + type NotificationEmailType + messageId String? + bountyId String? + campaignId String? + programId String? + partnerId String? + recipientUserId String? + deliveredAt Timestamp3? + openedAt Timestamp3? + bouncedAt Timestamp3? + createdAt Timestamp3 @default(now()) + + message Message? @relation(fields: [messageId], references: [id]) + bounty Bounty? @relation(fields: [bountyId], references: [id]) + campaign Campaign? @relation(fields: [campaignId], references: [id]) + partner Partner? @relation(fields: [partnerId], references: [id]) + + @@index([type]) + @@index([messageId]) + @@index([bountyId]) + @@index([campaignId]) + @@index([partnerId]) + + @@map("NotificationEmail") +} + +model UserNotificationPreferences { + id String @id @default(cuid(2)) + userId String @unique + dubLinks Boolean @default(true) + dubPartners Boolean @default(true) + partnerAccount Boolean @default(true) + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + + @@map("UserNotificationPreferences") +} + +// TODO: update this to WorkspaceNotificationPreferences +model NotificationPreference { + id String @id @default(cuid(2)) + projectUserId String @unique + linkUsageSummary Boolean @default(true) + domainConfigurationUpdates Boolean @default(true) + newPartnerSale Boolean @default(true) + newPartnerApplication Boolean @default(false) + pendingApplicationsSummary Boolean @default(true) + newBountySubmitted Boolean @default(true) + newMessageFromPartner Boolean @default(true) + fraudEventsSummary Boolean @default(true) + + projectUser ProjectUsers @relation(fields: [projectUserId], references: [id], onDelete: Cascade) + + @@map("NotificationPreference") +} + +model PartnerNotificationPreferences { + id String @id @default(cuid(2)) + partnerUserId String @unique + + commissionCreated Boolean @default(true) + applicationApproved Boolean @default(true) + newMessageFromProgram Boolean @default(true) + marketingCampaign Boolean @default(true) + connectPayoutReminder Boolean @default(true) + monthlyProgramSummary Boolean @default(true) + + partnerUser PartnerUser @relation(fields: [partnerUserId], references: [id], onDelete: Cascade) + + @@map("PartnerNotificationPreferences") +} + +model OAuthApp { + id String @id @default(cuid(2)) + integrationId String @unique + clientId String @unique + hashedClientSecret String + partialClientSecret String + redirectUris Json + pkce Boolean @default(false) + + oAuthCodes OAuthCode[] + integration Integration? @relation(fields: [integrationId], references: [id], onDelete: Cascade) + + @@map("OAuthApp") +} + +model OAuthCode { + id String @id @default(cuid(2)) + clientId String + userId String // User who granted access + projectId String // Workspace that user granted access to + code String @unique + scopes String? + redirectUri String + codeChallenge String? + codeChallengeMethod String? + expiresAt Timestamp3 + createdAt Timestamp3 @default(now()) + + oAuthApp OAuthApp @relation(fields: [clientId], references: [clientId], onDelete: Cascade) + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + + @@index([clientId]) + @@index([userId]) + @@index([projectId]) + + @@map("OAuthCode") +} + +model OAuthRefreshToken { + id String @id @default(cuid(2)) + installationId String + accessTokenId String + hashedRefreshToken String @unique + expiresAt Timestamp3 + createdAt Timestamp3 @default(now()) + + accessToken RestrictedToken @relation(fields: [accessTokenId], references: [id], onDelete: Cascade) + installedIntegration InstalledIntegration @relation(fields: [installationId], references: [id], onDelete: Cascade) + + @@index([installationId]) + @@index([accessTokenId]) + + @@map("OAuthRefreshToken") +} + +enum PartnerRole { + owner + member +} + +enum PartnerProfileType { + individual + company +} + +enum MonthlyTraffic { + ZeroToOneThousand + OneThousandToTenThousand + TenThousandToFiftyThousand + FiftyThousandToOneHundredThousand + OneHundredThousandPlus +} + +enum PartnerPayoutMethod { + connect + stablecoin + paypal +} + +// https://devdocs.veriff.com/v1/docs/how-to-generate-sessions-manually#verification-session-statuses +enum IdentityVerificationStatus { + started + submitted + approved + declined + resubmissionRequested + expired + abandoned + review +} + +model Partner { + id String @id @default(cuid(2)) + name String + username String? @unique + companyName String? + profileType PartnerProfileType @default("individual") + email String? @unique + image String? + description String? + country String? + + // identity verification fields + identityVerificationStatus IdentityVerificationStatus? + identityVerifiedAt Timestamp3? + veriffSessionId String? @unique + veriffMetadata Json? // see veriffMetadataSchema + + // payout fields + defaultPayoutMethod PartnerPayoutMethod? + payoutsEnabledAt Timestamp3? + connectPayoutsLastRemindedAt Timestamp3? + paypalEmail String? @unique + stripeConnectId String? @unique + stripeRecipientId String? @unique + payoutMethodHash String? + cryptoWalletAddress String? + + // timestamp fields + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + discoverableAt Timestamp3? + trustedAt Timestamp3? + + // miscellaneous fields + invoiceSettings Json? + changeHistoryLog Json? + referredByPartnerId String? + + programs ProgramEnrollment[] + users PartnerUser[] + invites PartnerInvite[] + links Link[] + customers Customer[] + payouts Payout[] + commissions Commission[] + bountySubmissions BountySubmission[] + postbacks Postback[] + messages Message[] @relation("PartnerMessages") + sentMessages Message[] @relation("SenderPartner") + comments PartnerComment[] + discountCodes DiscountCode[] + notificationEmails NotificationEmail[] + monthlyTraffic MonthlyTraffic? + industryInterests PartnerIndustryInterest[] + preferredEarningStructures PartnerPreferredEarningStructure[] + salesChannels PartnerSalesChannel[] + discoveredByPrograms DiscoveredPartner[] + fraudEventGroups FraudEventGroup[] + fraudEvents FraudEvent[] + fraudAlerts FraudAlert[] + partnerRewinds PartnerRewind[] + platforms PartnerPlatform[] + referrals PartnerReferral[] + referredApplications ProgramApplicationEvent[] + + @@index([country]) + @@index([discoverableAt]) + @@index([trustedAt]) + @@index([payoutMethodHash]) + @@index([cryptoWalletAddress]) + @@index([identityVerifiedAt]) + + @@map("Partner") +} + +model PartnerInvite { + id String @id @default(cuid(2)) + email String + expires Timestamp3 + partnerId String + role PartnerRole @default("member") + createdAt Timestamp3 @default(now()) + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@unique([email, partnerId]) + @@index([partnerId]) + + @@map("PartnerInvite") +} + +model PartnerUser { + id String @id @default(cuid(2)) + role PartnerRole @default("member") + userId String + partnerId String + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@unique([userId, partnerId]) + @@index([partnerId]) + + @@map("PartnerUser") +} + +model PartnerIndustryInterest { + id String @id @default(cuid(2)) + partnerId String + industryInterest IndustryInterest + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@unique([partnerId, industryInterest]) + + @@map("PartnerIndustryInterest") +} + +enum PreferredEarningStructure { + Revenue_Share + Per_Lead + Per_Sale + Per_Click + One_Time_Payment +} + +model PartnerPreferredEarningStructure { + id String @id @default(cuid(2)) + partnerId String + preferredEarningStructure PreferredEarningStructure + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@unique([partnerId, preferredEarningStructure]) + + @@map("PartnerPreferredEarningStructure") +} + +enum SalesChannel { + Blogs + Coupons + Direct_Reselling + Newsletters + Social_Media + Events + Company_Referrals +} + +model PartnerSalesChannel { + id String @id @default(cuid(2)) + partnerId String + salesChannel SalesChannel + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@unique([partnerId, salesChannel]) + + @@map("PartnerSalesChannel") +} + +enum PayoutStatus { + pending + processing + processed + sent + completed + failed + canceled +} + +enum PayoutMode { + internal + external +} + +model Payout { + id String @id @default(cuid(2)) + programId String + partnerId String + invoiceId String? + amount Int @default(0) + currency String @default("USD") + status PayoutStatus @default("pending") + mode PayoutMode? + method PartnerPayoutMethod? + description String? + periodStart Timestamp3? + periodEnd Timestamp3? + paypalTransferId String? @unique + stripeTransferId String? + stripePayoutId String? + stripePayoutTraceId String? + failureReason String? + webhookEventId String? @unique // only for external payouts + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + userId String? // user who made the payout + initiatedAt Timestamp3? + paidAt Timestamp3? + + program Program @relation(fields: [programId], references: [id]) + partner Partner @relation(fields: [partnerId], references: [id]) + programEnrollment ProgramEnrollment @relation(fields: [programId, partnerId], references: [programId, partnerId]) + invoice Invoice? @relation(fields: [invoiceId], references: [id]) + user User? @relation(fields: [userId], references: [id]) + commissions Commission[] + + @@index([programId, status]) + @@index([programId, partnerId]) // for programEnrollment relation + @@index([partnerId]) + @@index([invoiceId]) + @@index([status]) + @@index([method]) + @@index([userId]) + @@index([stripePayoutId]) + @@index([stripeTransferId]) + + @@map("Payout") +} + +enum PlatformType { + website + youtube + twitter + linkedin + instagram + tiktok +} + +model PartnerPlatform { + id String @id @default(cuid(2)) + partnerId String + type PlatformType + identifier String // The unique identifier for the platform (e.g., username for social platforms, domain for websites) + platformId String? // Platform-specific immutable ID (e.g., YouTube channel ID) + avatarUrl String? + subscribers BigInt @default(0) // Subscribers/followers for social platforms, also for newsletter subscribers + posts BigInt @default(0) + views BigInt @default(0) // Video views for YouTube, impressions for social platforms, pageviews for websites + metadata Json? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + verifiedAt Timestamp3? + lastCheckedAt Timestamp3? + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@unique([partnerId, type]) + @@index([type]) + + @@map("PartnerPlatform") +} + +enum PostbackReceiver { + custom + slack +} + +model Postback { + id String @id @default(cuid(2)) + partnerId String + name String + url String + secret String + triggers Json + receiver PostbackReceiver + disabledAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + partner Partner @relation(fields: [partnerId], references: [id], onDelete: Cascade) + + @@index([partnerId]) + + @@map("Postback") +} + +enum ProgramEnrollmentStatus { + pending // pending applications that need approval + approved // partner who has been approved/actively enrolled + rejected // program rejected the partner + invited // partner who has been invited + declined // partner declined the invite + deactivated // partner is deactivated by the program + banned // partner is banned from the program + archived // partner is archived by the program +} + +enum PartnerBannedReason { + tos_violation + inappropriate_content + fake_traffic + fraud + spam + brand_abuse +} + +enum ProgramPayoutMode { + internal // All payouts are handled by Dub + hybrid // Partners with payouts enabled are paid by Dub, others via external + external // All payouts are processed through external +} + +model Program { + id String @id @default(cuid(2)) + workspaceId String + defaultFolderId String + defaultGroupId String + name String + slug String @unique + domain String? @unique + url String? + logo String? + description String? + primaryRewardEvent EventType @default("sale") + minPayoutAmount Int @default(0) // Default minimum payout amount of $0 + payoutMode ProgramPayoutMode @default("internal") + + inviteEmailData JsonData? + embedData JsonData? + resources JsonData? + referralFormData JsonData? + applicationRequirements JsonData? + termsUrl String? + helpUrl String? + supportEmail String? + + messagingEnabledAt Timestamp3? + partnerNetworkEnabledAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + startedAt Timestamp3? + deactivatedAt Timestamp3? + + addedToMarketplaceAt Timestamp3? + featuredOnMarketplaceAt Timestamp3? + marketplaceHeaderImage String? + marketplaceRanking Int @default(2147483647) + + workspace Project @relation(fields: [workspaceId], references: [id]) + customDomain Domain? @relation(fields: [domain], references: [slug]) + partners ProgramEnrollment[] + payouts Payout[] + invoices Invoice[] + applications ProgramApplication[] + links Link[] + customers Customer[] + commissions Commission[] + rewards Reward[] + discounts Discount[] @relation("ProgramDiscounts") + discountCodes DiscountCode[] + groups PartnerGroup[] + partnerGroupDefaultLinks PartnerGroupDefaultLink[] + bounties Bounty[] + bountySubmissions BountySubmission[] + workflows Workflow[] + messages Message[] + comments PartnerComment[] + campaigns Campaign[] + emailDomains EmailDomain[] + discoveredPartners DiscoveredPartner[] + similarPrograms ProgramSimilarity[] @relation("ProgramSimilarities") + similarToPrograms ProgramSimilarity[] @relation("SimilarProgram") + categories ProgramCategory[] + fraudRules FraudRule[] + fraudEventGroups FraudEventGroup[] + sourceFraudEvents FraudEvent[] @relation("SourceFraudEvents") + fraudAlerts FraudAlert[] + referrals PartnerReferral[] + + @@index([workspaceId]) + @@index([addedToMarketplaceAt]) + + @@map("Program") +} + +model ProgramEnrollment { + id String @id @default(cuid(2)) + partnerId String + programId String + tenantId String? + groupId String? + applicationId String? @unique + clickRewardId String? + leadRewardId String? + saleRewardId String? + discountId String? + status ProgramEnrollmentStatus @default("pending") + + // partner stats + totalClicks Int @default(0) // total clicks + totalLeads Int @default(0) // total leads + totalConversions Int @default(0) // total conversions + totalSales Int @default(0) // total sales + totalSaleAmount BigInt @default(0) // total sale amount (in cents) + totalCommissions BigInt @default(0) // total commissions earned by the partner (in cents) + + // calculated stats + netRevenue BigInt @default(0) // totalSaleAmount - totalCommissions + earningsPerClick Float @default(0) // totalSaleAmount / totalClicks + averageLifetimeValue Float? // totalSaleAmount / totalConversions (in cents) + clickToLeadRate Float? // totalLeads / totalClicks + clickToConversionRate Float? // totalConversions / totalClicks + leadToConversionRate Float? // totalConversions / totalLeads + returnOnAdSpend Float? // totalSaleAmount / totalCommissions + lastConversionAt Timestamp3? // latest conversion from partner's links + daysSinceLastConversion Int? // days since lastConversionAt + consistencyScore Int? // based on daysSinceLastConversion + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + customerDataSharingEnabledAt Timestamp3? + groupMoveDisabledAt Timestamp3? + bannedAt Timestamp3? + bannedReason PartnerBannedReason? + + partner Partner @relation(fields: [partnerId], references: [id], onUpdate: Cascade, onDelete: Cascade) + program Program @relation(fields: [programId], references: [id], onUpdate: Cascade, onDelete: Cascade) + links Link[] + customers Customer[] + partnerGroup PartnerGroup? @relation(fields: [groupId], references: [id]) + application ProgramApplication? @relation(fields: [applicationId], references: [id]) + clickReward Reward? @relation("ClickRewardEnrollments", fields: [clickRewardId], references: [id]) + leadReward Reward? @relation("LeadRewardEnrollments", fields: [leadRewardId], references: [id]) + saleReward Reward? @relation("SaleRewardEnrollments", fields: [saleRewardId], references: [id]) + discount Discount? @relation(fields: [discountId], references: [id]) + bountySubmissions BountySubmission[] + discountCodes DiscountCode[] + commissions Commission[] + payouts Payout[] + messages Message[] + fraudEventGroups FraudEventGroup[] + referrals PartnerReferral[] + fraudAlerts FraudAlert[] + // unique constraints + @@unique([partnerId, programId]) + @@unique([tenantId, programId]) + // indexes for sorting partners + @@index([programId, status, totalClicks]) + @@index([programId, status, totalLeads]) + @@index([programId, status, totalConversions]) + @@index([programId, status, totalSaleAmount]) + @@index([programId, status, totalCommissions]) + @@index([programId, status, netRevenue]) + @@index([programId, status, earningsPerClick]) + @@index([programId, status, averageLifetimeValue]) + @@index([programId, status, clickToLeadRate]) + @@index([programId, status, clickToConversionRate]) + @@index([programId, status, leadToConversionRate]) + @@index([programId, status, returnOnAdSpend]) + // other indexes + @@index([programId, groupId]) + @@index([groupId, status]) + @@index([clickRewardId]) + @@index([leadRewardId]) + @@index([saleRewardId]) + @@index([discountId]) + + @@map("ProgramEnrollment") +} + +enum ReferralStatus { + pending + qualified + meeting + negotiation + unqualified + closedWon + closedLost +} + +model PartnerReferral { + id String @id @default(cuid(2)) + programId String + partnerId String + customerId String? + name String + email String + company String + formData JsonData? + status ReferralStatus @default("pending") + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id]) + partner Partner @relation(fields: [partnerId], references: [id]) + programEnrollment ProgramEnrollment @relation(fields: [programId, partnerId], references: [programId, partnerId]) + customer Customer? @relation(fields: [customerId], references: [id]) + + @@index([programId, partnerId]) + @@index([partnerId]) + @@index([customerId]) + + @@map("PartnerReferral") +} + +enum EventType { + click + lead + sale +} + +enum RewardStructure { + percentage + flat +} + +model Reward { + id String @id @default(cuid(2)) + programId String + description String? + tooltipDescription String? + event EventType + type RewardStructure @default("percentage") + amountInCents Int? + amountInPercentage Numeric5p2? + maxDuration Int? // in months (0 -> not recurring, null -> infinite) + modifiers JsonData? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id]) + clickEnrollments ProgramEnrollment[] @relation("ClickRewardEnrollments") + leadEnrollments ProgramEnrollment[] @relation("LeadRewardEnrollments") + saleEnrollments ProgramEnrollment[] @relation("SaleRewardEnrollments") + commissions Commission[] + + @@index([programId, event]) + @@index([event]) // used in aggregate-clicks cron job + + @@map("Reward") +} + +model Tag { + id String @id @default(cuid(2)) + name String + color String @default("blue") + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade) + projectId String + links LinkTag[] + + @@unique([name, projectId]) + @@index([projectId]) + + @@map("Tag") +} + +model LinkTag { + id String @id @default(cuid(2)) + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + link Link @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade) + linkId String + tag Tag @relation(fields: [tagId], references: [id], onUpdate: Cascade, onDelete: Cascade) + tagId String + + @@unique([linkId, tagId]) + @@index([tagId]) + + @@map("LinkTag") +} + +model Token { + id String @id @default(cuid(2)) + name String + hashedKey String @unique + partialKey String + expires Timestamp3? + lastUsed Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + userId String + + @@index([userId]) + + @@map("Token") +} + +model RestrictedToken { + id String @id @default(cuid(2)) + name String + hashedKey String @unique + partialKey String + scopes String? // space separated (Eg: "links.write domains.read") + expires Timestamp3? + lastUsed Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + userId String + projectId String + installationId String? // if the token is generated by an OAuth client + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + refreshTokens OAuthRefreshToken[] + installedIntegration InstalledIntegration? @relation(fields: [installationId], references: [id], onDelete: Cascade) + + @@index([userId]) + @@index([projectId]) + @@index([installationId]) + + @@map("RestrictedToken") +} + +// Login tokens +model VerificationToken { + id String @id @default(cuid(2)) + identifier String + token String @unique + expires Timestamp3 + + @@unique([identifier, token]) + + @@map("VerificationToken") +} + +// Email verification OTPs +model EmailVerificationToken { + id String @id @default(cuid(2)) + identifier String + token String @unique + expires Timestamp3 + + @@unique([identifier, token]) + + @@map("EmailVerificationToken") +} + +// Password reset tokens +model PasswordResetToken { + id String @id @default(cuid(2)) + identifier String + token String @unique + expires Timestamp3 + + @@unique([identifier, token]) + + @@map("PasswordResetToken") +} + +model UtmTemplate { + id String @id @default(cuid(2)) + name String + + // Parameters + utm_source String? + utm_medium String? + utm_campaign String? + utm_term String? + utm_content String? + ref String? + + // User who created the template + user User? @relation(fields: [userId], references: [id]) + userId String? + + // Project that the template belongs to + project Project? @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade) + projectId String? + + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + @@unique([projectId, name]) + @@index([userId]) + + @@map("UtmTemplate") +} + +enum WebhookReceiver { + user + zapier + make + slack + segment +} + +model Webhook { + id String @id @default(cuid(2)) + projectId String + installationId String? // indicates which integration installation added the webhook + receiver WebhookReceiver @default("user") + name String + url String + secret String + triggers Json + consecutiveFailures Int @default(0) + lastFailedAt Timestamp3? + disabledAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + installedIntegration InstalledIntegration? @relation(fields: [installationId], references: [id], onDelete: Cascade) + links LinkWebhook[] + + @@index([projectId]) + @@index([installationId]) + + @@map("Webhook") +} + +model LinkWebhook { + id String @id @default(cuid(2)) + linkId String + webhookId String + + link Link @relation(fields: [linkId], references: [id], onUpdate: Cascade, onDelete: Cascade) + webhook Webhook @relation(fields: [webhookId], references: [id], onUpdate: Cascade, onDelete: Cascade) + + @@unique([linkId, webhookId]) + @@index([webhookId]) + + @@map("LinkWebhook") +} + +enum WorkflowTrigger { + partnerEnrolled // scheduled + partnerMetricsUpdated + + // TODO: Remove this after migrations + clickRecorded + commissionEarned + leadRecorded + saleRecorded +} + +model Workflow { + id String @id @default(cuid(2)) + programId String + name String? + trigger WorkflowTrigger + triggerConditions Json + actions Json + disabledAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + + @@index([programId, trigger]) + + @@map("Workflow") +} + +enum PlanPeriod { + monthly + yearly + quarterly + biweekly +} + +model Project { + id String @id @default(cuid(2)) + name String + slug String @unique + logo String? + inviteCode String? @unique + defaultProgramId String? @unique // default affiliate program ID for the workspace + + plan String @default("free") + planTier Int @default(1) + planPeriod PlanPeriod? // monthly, yearly, etc. from Stripe price.recurring.interval + stripeId String? @unique // Stripe subscription ID + billingCycleStart Int // day of the month when the billing cycle starts + billingCycleEndsAt Timestamp3? // derived from Stripe current_period_end + trialEndsAt Timestamp3? // when set and in the future, the workspace is on a Stripe subscription free trial + subscriptionCanceledAt Timestamp3? // when the workspace's subscription was canceled (or set to cancel) + paymentFailedAt Timestamp3? + invoicePrefix String? @unique // prefix used to generate unique invoice numbers (for Dub Payouts) + + stripeConnectId String? @unique // for Stripe Integration + shopifyStoreId String? @unique // for Shopify Integration + + totalLinks Int @default(0) // Total number of links in the workspace + totalClicks Int @default(0) // Total number of clicks in the workspace + + usage Int @default(0) + usageLimit Int @default(1000) + linksUsage Int @default(0) + linksLimit Int @default(25) + payoutsUsage Int @default(0) + payoutsLimit Int @default(0) + payoutFee Float @default(0.05) // processing fee (in decimals) for partner payouts + payoutFeeWaiverLimit Int @default(0) // amount in cents for which the payout fee will be waived + payoutFeeWaiverUsage Int @default(0) // how much of payoutFeeWaiverLimit has been used + + domainsLimit Int @default(3) + tagsLimit Int @default(5) + foldersUsage Int @default(0) + foldersLimit Int @default(0) + partnersUsage Int @default(0) + partnersLimit Int @default(0) + groupsLimit Int @default(0) + usersLimit Int @default(1) + aiUsage Int @default(0) + aiLimit Int @default(10) + networkInvitesLimit Int @default(0) + + referralLinkId String? @unique + referredSignups Int @default(0) + + store Json? // General key-value store for things like persisting toggles, dismissing popups, etc. + siteVisitTrackingSettings Json? // Site visit tracking: sitemaps, short-link domain, Site Links folder id + allowedHostnames Json? + publishableKey String? @unique // for the client-side publishable key + + conversionEnabled Boolean @default(false) // Whether to enable conversion tracking for links by default + webhookEnabled Boolean @default(false) + dotLinkClaimed Boolean @default(false) + fastDirectDebitPayouts Boolean @default(false) + + ssoEmailDomain String? @unique + ssoEnforcedAt Timestamp3? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + usageLastChecked Timestamp3 @default(now()) + + users ProjectUsers[] + invites ProjectInvite[] + sentEmails SentEmail[] + links Link[] + domains Domain[] + tags Tag[] + programs Program[] + invoices Invoice[] + customers Customer[] + defaultDomains DefaultDomains[] + restrictedTokens RestrictedToken[] + oAuthCodes OAuthCode[] + integrations Integration[] // Integrations workspace published + installedIntegrations InstalledIntegration[] // Integrations workspace installed + webhooks Webhook[] + folders Folder[] + registeredDomains RegisteredDomain[] + dashboards Dashboard[] + utmTemplates UtmTemplate[] + yearInReviews YearInReview[] + + @@index([usageLastChecked]) + @@index([trialEndsAt]) + + @@map("Project") +} + +enum WorkspaceRole { + owner + member + viewer + billing +} + +model ProjectInvite { + id String @id @default(cuid(2)) + email String + expires Timestamp3 + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + projectId String + role WorkspaceRole @default("member") + createdAt Timestamp3 @default(now()) + + @@unique([email, projectId]) + @@index([projectId]) + + @@map("ProjectInvite") +} + +model ProjectUsers { + id String @id @default(cuid(2)) + role WorkspaceRole @default("member") + userId String + projectId String + workspacePreferences Json? + defaultFolderId String? + createdAt Timestamp3 @default(now()) + updatedAt temporal.updatedAt() + + user User @relation(fields: [userId], references: [id], onDelete: Cascade) + project Project @relation(fields: [projectId], references: [id], onDelete: Cascade) + + @@unique([userId, projectId]) + @@index([projectId]) + + @@map("ProjectUsers") +} + +// TODO: could potentially combine this with NotificationEmail in the future? +model SentEmail { + id String @id @default(cuid(2)) + type String + createdAt Timestamp3 @default(now()) + project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade) + projectId String? + + @@index([projectId]) + + @@map("SentEmail") +} diff --git a/packages/prisma/schema/customer.prisma b/packages/prisma/schema/customer.prisma index 918a4db85b3..7e01622c94d 100644 --- a/packages/prisma/schema/customer.prisma +++ b/packages/prisma/schema/customer.prisma @@ -45,5 +45,4 @@ model Customer { @@index(partnerId) @@index(linkId) @@index(country) - @@fulltext([email, name]) // For full-text search } diff --git a/packages/prisma/schema/domain.prisma b/packages/prisma/schema/domain.prisma index 2ae451e303b..e2865d4eac2 100644 --- a/packages/prisma/schema/domain.prisma +++ b/packages/prisma/schema/domain.prisma @@ -3,8 +3,8 @@ model Domain { slug String @unique verified Boolean @default(false) placeholder String? - expiredUrl String? @db.LongText // URL to redirect to for expired links - notFoundUrl String? @db.LongText // URL to redirect to for links that don't exist + expiredUrl String? @db.Text // URL to redirect to for expired links + notFoundUrl String? @db.Text // URL to redirect to for links that don't exist primary Boolean @default(false) archived Boolean @default(false) lastChecked DateTime @default(now()) diff --git a/packages/prisma/schema/integration.prisma b/packages/prisma/schema/integration.prisma index 043709fee96..6a95e4037db 100644 --- a/packages/prisma/schema/integration.prisma +++ b/packages/prisma/schema/integration.prisma @@ -5,7 +5,7 @@ model Integration { name String slug String @unique description String? - readme String? @db.LongText + readme String? @db.Text developer String website String logo String? diff --git a/packages/prisma/schema/lead.prisma b/packages/prisma/schema/lead.prisma index 66b1c4fc355..a8b3b60f8a3 100644 --- a/packages/prisma/schema/lead.prisma +++ b/packages/prisma/schema/lead.prisma @@ -29,5 +29,4 @@ model SubmittedLead { @@index([programId, partnerId]) @@index(partnerId) @@index(customerId) - @@fulltext([email, name]) } diff --git a/packages/prisma/schema/link.prisma b/packages/prisma/schema/link.prisma index cd5c7d5a919..3cc2a6e2cc3 100644 --- a/packages/prisma/schema/link.prisma +++ b/packages/prisma/schema/link.prisma @@ -2,7 +2,7 @@ model Link { id String @id @default(cuid()) domain String // domain of the link (e.g. dub.sh) – also stored on Redis key String // key of the link (e.g. /github) – also stored on Redis - url String @db.LongText // target url (e.g. https://github.com/dubinc/dub) – also stored on Redis + url String @db.Text // target url (e.g. https://github.com/dubinc/dub) – also stored on Redis shortLink String @unique @db.VarChar(400) // new column for the full short link archived Boolean @default(false) // whether the link is archived or not expiresAt DateTime? // when the link expires – stored on Redis via ttl @@ -13,7 +13,7 @@ model Link { proxy Boolean @default(false) // Proxy to use custom OG tags (stored on redis) – if false, will use OG tags from target url title String? // OG title for the link (e.g. Dub - open-source link attribution platform) description String? @db.VarChar(280) // OG description for the link (e.g. The modern link attribution platform for short links, conversion tracking, and affiliate programs.) - image String? @db.LongText // OG image for the link (e.g. https://d.to/og) + image String? @db.Text // OG image for the link (e.g. https://d.to/og) video String? @db.Text // OG video for the link // UTM parameters @@ -95,7 +95,7 @@ model Link { @@unique([domain, key]) // for getting a link by domain and key @@unique([projectId, externalId]) // for getting a link by externalId @@index([projectId, tenantId]) // for filtering by tenantId - @@index([projectId, url(length: 500)]) // for upserting a link by URL + @@index([projectId]) // Postgres URL lookup index lives in postdeploy SQL @@index([projectId, folderId, archived, createdAt(sort: Desc)]) // most getLinksForWorkspace queries @@index([programId, partnerId]) // for getting a referral link (programId + partnerId) @@index(partnerId) // for getting links by partnerId diff --git a/packages/prisma/schema/message.prisma b/packages/prisma/schema/message.prisma index cd03044e405..ce502143d46 100644 --- a/packages/prisma/schema/message.prisma +++ b/packages/prisma/schema/message.prisma @@ -20,11 +20,11 @@ model Message { createdAt DateTime @default(now()) updatedAt DateTime @updatedAt - program Program @relation(fields: [programId], references: [id], onDelete: Cascade) - partner Partner? @relation(fields: [partnerId], references: [id], onDelete: Cascade) - senderUser User @relation(fields: [senderUserId], references: [id], onDelete: Cascade) - senderPartner Partner? @relation("SenderPartner", fields: [senderPartnerId], references: [id], onDelete: Cascade) - emails NotificationEmail[] + program Program @relation(fields: [programId], references: [id], onDelete: Cascade) + partner Partner? @relation(fields: [partnerId], references: [id], onDelete: Cascade) + senderUser User @relation(fields: [senderUserId], references: [id], onDelete: Cascade) + senderPartner Partner? @relation("SenderPartner", fields: [senderPartnerId], references: [id], onDelete: Cascade) + emails NotificationEmail[] @@index([programId, partnerId]) @@index(partnerId) diff --git a/packages/prisma/schema/partner.prisma b/packages/prisma/schema/partner.prisma index 88ee744ff86..1e86bb610cb 100644 --- a/packages/prisma/schema/partner.prisma +++ b/packages/prisma/schema/partner.prisma @@ -71,11 +71,11 @@ model Partner { cryptoWalletAddress String? // timestamp fields - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - submittedAt DateTime? - reviewedAt DateTime? - trustedAt DateTime? + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + submittedAt DateTime? + reviewedAt DateTime? + trustedAt DateTime? // miscellaneous fields invoiceSettings Json? @@ -116,7 +116,6 @@ model Partner { @@index(payoutMethodHash) @@index(cryptoWalletAddress) @@index(identityVerifiedAt) - @@fulltext([email, name, companyName]) // For full-text search } model PartnerInvite { diff --git a/packages/prisma/schema/postback.prisma b/packages/prisma/schema/postback.prisma index 525aaec64a5..90cfb153ab8 100644 --- a/packages/prisma/schema/postback.prisma +++ b/packages/prisma/schema/postback.prisma @@ -7,7 +7,7 @@ model Postback { id String @id @default(cuid()) partnerId String name String - url String @db.LongText + url String @db.Text secret String triggers Json receiver PostbackReceiver diff --git a/packages/prisma/schema/schema.prisma b/packages/prisma/schema/schema.prisma index dda14954057..19673ea07d9 100644 --- a/packages/prisma/schema/schema.prisma +++ b/packages/prisma/schema/schema.prisma @@ -1,5 +1,5 @@ datasource db { - provider = "mysql" + provider = "postgresql" url = env("DATABASE_URL") relationMode = "prisma" } diff --git a/packages/prisma/schema/webhook.prisma b/packages/prisma/schema/webhook.prisma index 33575dcb0ce..7e0af64c447 100644 --- a/packages/prisma/schema/webhook.prisma +++ b/packages/prisma/schema/webhook.prisma @@ -12,7 +12,7 @@ model Webhook { installationId String? // indicates which integration installation added the webhook receiver WebhookReceiver @default(user) name String - url String @db.LongText + url String @db.Text secret String triggers Json consecutiveFailures Int @default(0) diff --git a/packages/prisma/scripts/postdeploy-postgres.ts b/packages/prisma/scripts/postdeploy-postgres.ts new file mode 100644 index 00000000000..c99c2866715 --- /dev/null +++ b/packages/prisma/scripts/postdeploy-postgres.ts @@ -0,0 +1,44 @@ +import { readFileSync } from "fs"; +import { join } from "path"; +import { Client } from "pg"; + +const databaseUrl = process.env.DATABASE_URL; + +if (!databaseUrl) { + throw new Error("DATABASE_URL is required to run PostgreSQL postdeploy SQL."); +} + +const sql = readFileSync( + join(process.cwd(), "postgres-postdeploy.sql"), + "utf8", +); + +const statements = sql + .split(";") + .map((statement) => statement.trim()) + .filter(Boolean); + +async function main() { + const client = new Client({ + connectionString: databaseUrl, + ssl: + process.env.POSTGRES_SSL === "true" + ? { rejectUnauthorized: false } + : undefined, + }); + + await client.connect(); + + try { + for (const statement of statements) { + await client.query(statement); + } + } finally { + await client.end(); + } +} + +main().catch((error) => { + console.error(error); + process.exit(1); +}); diff --git a/packages/prisma/scripts/prisma-next-ddl-compare.ts b/packages/prisma/scripts/prisma-next-ddl-compare.ts new file mode 100644 index 00000000000..31089ab30d3 --- /dev/null +++ b/packages/prisma/scripts/prisma-next-ddl-compare.ts @@ -0,0 +1,590 @@ +import { spawnSync } from "node:child_process"; +import { readFile } from "node:fs/promises"; +import { resolve } from "node:path"; +import { Pool } from "pg"; + +const baseDatabaseUrl = + process.env.DATABASE_URL ?? "postgresql://postgres:postgres@localhost:5432/dub"; + +type Snapshot = { + readonly items: Set; + readonly indexes: Map; + readonly foreignKeys: Set; +}; + +const syntheticIdTables = new Set([ + "EmailVerificationToken", + "PartnerIndustryInterest", + "PartnerInvite", + "PartnerPreferredEarningStructure", + "PartnerSalesChannel", + "PasswordResetToken", + "ProgramCategory", + "ProjectInvite", + "VerificationToken", +]); + +const quoteIdent = (value: string) => `"${value.replace(/"/g, '""')}"`; + +const databaseUrlFor = (databaseName: string) => { + const url = new URL(baseDatabaseUrl); + url.pathname = `/${databaseName}`; + return url.toString(); +}; + +const adminDatabaseUrl = () => { + const url = new URL(baseDatabaseUrl); + url.pathname = "/postgres"; + return url.toString(); +}; + +const normalize = (value: unknown) => + String(value ?? "") + .replace(/public\\./g, "") + .replace(/::[a-zA-Z_][a-zA-Z0-9_]*(\\[\\])?/g, "") + .replace(/\bCURRENT_TIMESTAMP\b/gi, "now()") + .replace(/timestamp\(3\) without time zone/gi, "timestamp without time zone") + .replace(/timestamp\(0\) without time zone/gi, "timestamp without time zone") + .replace(/character\(24\)/gi, "text") + .replace(/\\s+/g, " ") + .trim(); + +const pgArray = (value: unknown) => + Array.isArray(value) + ? value.map(String) + : String(value ?? "") + .replace(/^\{|\}$/g, "") + .split(",") + .filter(Boolean); + +const stripIndexSort = (value: string) => + value + .replace(/\\s+(ASC|DESC)(?=[,\\)])/gi, "") + .replace(/\\s+NULLS\\s+(FIRST|LAST)(?=[,\\)])/gi, ""); + +const relationAction = (code: string) => { + switch (code) { + case "a": + return "NoAction"; + case "r": + return "Restrict"; + case "c": + return "Cascade"; + case "n": + return "SetNull"; + case "d": + return "SetDefault"; + default: + return code; + } +}; + +const run = ( + args: string[], + databaseUrl: string, + options: { allowDbInitVerificationFailure?: boolean } = {}, +) => { + const result = spawnSync("pnpm", args, { + cwd: process.cwd(), + env: { + ...process.env, + DATABASE_URL: databaseUrl, + }, + encoding: "utf8", + }); + + if (result.status !== 0) { + if ( + options.allowDbInitVerificationFailure && + result.stdout.includes('"code": "PN-RUN-3020"') && + result.stdout.includes("Database schema does not satisfy contract") + ) { + console.warn("Prisma Next db init applied DDL but failed self-verification; continuing to snapshot."); + return; + } + + throw new Error( + [ + `Command failed: pnpm ${args.join(" ")}`, + result.stdout.trim(), + result.stderr.trim(), + ] + .filter(Boolean) + .join("\\n"), + ); + } +}; + +async function applyPrismaNextPlannedSql(databaseUrl: string) { + const { loadConfig } = await import("@prisma-next/cli/config-loader"); + const { createControlClient, enrichContract } = await import("@prisma-next/cli/control-api"); + const config = await loadConfig("./prisma-next.config.ts"); + const migrationsDir = resolve(process.cwd(), config.migrations?.dir ?? "migrations"); + const contractJson = JSON.parse(await readFile("./schema/contract.json", "utf8")); + const frameworkComponents = [ + config.family, + config.target, + config.adapter, + ...(config.extensionPacks ?? []), + ]; + const contract = enrichContract(contractJson, frameworkComponents); + const client = createControlClient({ + family: config.family, + target: config.target, + adapter: config.adapter, + driver: config.driver, + extensionPacks: config.extensionPacks ?? [], + connection: databaseUrl, + }); + + const result = await client + .dbInit({ + mode: "plan", + contract, + connection: databaseUrl, + migrationsDir, + }) + .finally(() => client.close()); + + if (!result.ok) { + throw new Error(`Prisma Next db init planning failed: ${result.failure.summary}`); + } + + const plan = result.value.plan as { + readonly operations: readonly unknown[]; + readonly sql?: readonly string[]; + readonly preview?: { + readonly statements?: readonly { readonly language: string; readonly text: string }[]; + }; + }; + const statements = + plan.sql ?? + plan.preview?.statements + ?.filter((statement) => statement.language === "sql") + .map((statement) => statement.text) ?? + []; + if (statements.length === 0 && plan.operations.length > 0) { + throw new Error("Prisma Next db init plan did not expose SQL statements."); + } + + const pool = new Pool({ connectionString: databaseUrl }); + try { + for (const statement of statements) { + try { + await pool.query(statement); + } catch (error) { + throw new Error(`Failed to apply Prisma Next DDL statement:\n${statement}`, { + cause: error, + }); + } + } + } finally { + await pool.end(); + } +} + +async function createDatabase(pool: Pool, name: string) { + await pool.query(`CREATE DATABASE ${quoteIdent(name)}`); +} + +async function dropDatabase(pool: Pool, name: string) { + await pool.query("select pg_terminate_backend(pid) from pg_stat_activity where datname = $1", [ + name, + ]); + await pool.query(`DROP DATABASE IF EXISTS ${quoteIdent(name)}`); +} + +async function snapshot(databaseUrl: string): Promise { + const pool = new Pool({ connectionString: databaseUrl }); + try { + const items = new Set(); + + const enums = await pool.query<{ + name: string; + values: string[]; + }>(` + select t.typname as name, array_agg(e.enumlabel order by e.enumsortorder) as values + from pg_type t + join pg_enum e on e.enumtypid = t.oid + join pg_namespace n on n.oid = t.typnamespace + where n.nspname = 'public' + group by t.typname + order by t.typname + `); + for (const row of enums.rows) { + items.add(`enum:${row.name}:${pgArray(row.values).join(",")}`); + } + + const tables = await pool.query<{ table_name: string }>(` + select c.relname as table_name + from pg_class c + join pg_namespace n on n.oid = c.relnamespace + where n.nspname = 'public' and c.relkind = 'r' + order by c.relname + `); + for (const row of tables.rows) { + items.add(`table:${row.table_name}`); + } + + const columns = await pool.query<{ + table_name: string; + column_name: string; + formatted_type: string; + not_null: boolean; + default_value: string | null; + }>(` + select + c.relname as table_name, + a.attname as column_name, + format_type(a.atttypid, a.atttypmod) as formatted_type, + a.attnotnull as not_null, + pg_get_expr(d.adbin, d.adrelid) as default_value + from pg_attribute a + join pg_class c on c.oid = a.attrelid + join pg_namespace n on n.oid = c.relnamespace + left join pg_attrdef d on d.adrelid = a.attrelid and d.adnum = a.attnum + where n.nspname = 'public' + and c.relkind = 'r' + and a.attnum > 0 + and not a.attisdropped + order by c.relname, a.attnum + `); + for (const row of columns.rows) { + items.add( + [ + "column", + row.table_name, + row.column_name, + normalize(row.formatted_type), + row.not_null ? "notNull" : "nullable", + `default=${normalize(row.default_value)}`, + ].join(":"), + ); + } + + const constraints = await pool.query<{ + table_name: string; + type: "p" | "u"; + columns: string[]; + }>(` + select + c.relname as table_name, + con.contype as type, + array_agg(a.attname order by ord.ordinality) as columns + from pg_constraint con + join pg_class c on c.oid = con.conrelid + join pg_namespace n on n.oid = c.relnamespace + join unnest(con.conkey) with ordinality as ord(attnum, ordinality) on true + join pg_attribute a on a.attrelid = c.oid and a.attnum = ord.attnum + where n.nspname = 'public' and con.contype in ('p', 'u') + group by c.relname, con.contype, con.conname + order by c.relname, con.contype, array_agg(a.attname order by ord.ordinality)::text + `); + for (const row of constraints.rows) { + items.add( + `${row.type === "p" ? "primary" : "unique"}:${row.table_name}(${pgArray(row.columns).join(",")})`, + ); + } + + const indexes = new Map(); + const indexRows = await pool.query<{ + table_name: string; + index_name: string; + index_def: string; + is_unique: boolean; + columns: string[]; + }>(` + select + table_cls.relname as table_name, + index_cls.relname as index_name, + pg_get_indexdef(index_cls.oid) as index_def, + idx.indisunique as is_unique, + array_agg(attr.attname order by ord.ordinality) as columns + from pg_index idx + join pg_class index_cls on index_cls.oid = idx.indexrelid + join pg_class table_cls on table_cls.oid = idx.indrelid + join pg_namespace n on n.oid = table_cls.relnamespace + join unnest(idx.indkey) with ordinality as ord(attnum, ordinality) on ord.attnum > 0 + join pg_attribute attr on attr.attrelid = table_cls.oid and attr.attnum = ord.attnum + left join pg_constraint con on con.conindid = index_cls.oid + where n.nspname = 'public' + and not idx.indisprimary + and con.oid is null + group by table_cls.relname, index_cls.relname, index_cls.oid, idx.indisunique + order by table_cls.relname, index_cls.relname + `); + for (const row of indexRows.rows) { + const columns = pgArray(row.columns); + if (row.is_unique) { + items.add(`unique:${row.table_name}(${columns.join(",")})`); + continue; + } + + const key = `${row.table_name}:${row.index_name}`; + const value = columns.join(","); + indexes.set(key, value); + items.add(`index:${key}:${value}`); + } + + const foreignKeys = new Set(); + const fkRows = await pool.query<{ + table_name: string; + columns: string[]; + foreign_table_name: string; + foreign_columns: string[]; + on_delete: string; + on_update: string; + }>(` + select + src.relname as table_name, + array_agg(src_attr.attname order by src_ord.ordinality) as columns, + dst.relname as foreign_table_name, + array_agg(dst_attr.attname order by dst_ord.ordinality) as foreign_columns, + con.confdeltype as on_delete, + con.confupdtype as on_update + from pg_constraint con + join pg_class src on src.oid = con.conrelid + join pg_namespace n on n.oid = src.relnamespace + join pg_class dst on dst.oid = con.confrelid + join unnest(con.conkey) with ordinality as src_ord(attnum, ordinality) on true + join unnest(con.confkey) with ordinality as dst_ord(attnum, ordinality) + on dst_ord.ordinality = src_ord.ordinality + join pg_attribute src_attr on src_attr.attrelid = src.oid and src_attr.attnum = src_ord.attnum + join pg_attribute dst_attr on dst_attr.attrelid = dst.oid and dst_attr.attnum = dst_ord.attnum + where n.nspname = 'public' and con.contype = 'f' + group by src.relname, dst.relname, con.conname, con.confdeltype, con.confupdtype + order by src.relname, con.conname + `); + for (const row of fkRows.rows) { + const columns = pgArray(row.columns); + const foreignColumns = pgArray(row.foreign_columns); + foreignKeys.add( + `foreignKey:${row.table_name}(${columns.join(",")})->${row.foreign_table_name}(${foreignColumns.join(",")}):onDelete=${relationAction(row.on_delete)}:onUpdate=${relationAction(row.on_update)}`, + ); + } + + return { items, indexes, foreignKeys }; + } finally { + await pool.end(); + } +} + +const without = (left: Set, right: Set) => + [...left].filter((item) => !right.has(item)).sort(); + +function classifyIndexSortDiffs(prisma6Only: string[], nextOnly: string[]) { + const expected: string[] = []; + const consumedNext = new Set(); + const remainingPrisma6: string[] = []; + const parseIndex = (item: string) => { + const match = item.match(/^index:([^:]+):([^:]+):(.+)$/); + if (!match) { + return null; + } + return { + table: match[1]!, + name: match[2]!, + columns: match[3]!.split(",").filter(Boolean), + }; + }; + + for (const item of prisma6Only) { + if (!item.startsWith("index:")) { + remainingPrisma6.push(item); + continue; + } + + const stripped = stripIndexSort(item); + const parsed = parseIndex(item); + const nextIndex = nextOnly.findIndex( + (candidate, index) => { + if (consumedNext.has(index) || !candidate.startsWith("index:")) { + return false; + } + if (stripIndexSort(candidate) === stripped) { + return true; + } + const candidateParsed = parseIndex(candidate); + return ( + parsed !== null && + candidateParsed !== null && + candidateParsed.table === parsed.table && + candidateParsed.name === parsed.name && + candidateParsed.columns.slice().sort().join(",") === + parsed.columns.slice().sort().join(",") + ); + }, + ); + + if (nextIndex === -1) { + remainingPrisma6.push(item); + continue; + } + + consumedNext.add(nextIndex); + expected.push(`index sort/order not preserved: ${item}`); + } + + const remainingNext = nextOnly.filter((_, index) => !consumedNext.has(index)); + return { expected, remainingPrisma6, remainingNext }; +} + +function classifyUpdatedAtTimestampTypeDiffs(prisma6Only: string[], nextOnly: string[]) { + const expected: string[] = []; + const consumedNext = new Set(); + const remainingPrisma6: string[] = []; + + for (const item of prisma6Only) { + const match = item.match(/^column:([^:]+):updatedAt:timestamp without time zone:notNull:default=$/); + if (!match) { + remainingPrisma6.push(item); + continue; + } + + const table = match[1]!; + const nextIndex = nextOnly.findIndex( + (candidate, index) => + !consumedNext.has(index) && + candidate === `column:${table}:updatedAt:timestamp with time zone:notNull:default=`, + ); + + if (nextIndex === -1) { + remainingPrisma6.push(item); + continue; + } + + consumedNext.add(nextIndex); + expected.push( + `Prisma Next temporal.updatedAt() currently emits timestamptz while Prisma 6 uses timestamp(3): ${table}.updatedAt`, + ); + } + + const remainingNext = nextOnly.filter((_, index) => !consumedNext.has(index)); + return { expected, remainingPrisma6, remainingNext }; +} + +function classifySyntheticIdDiffs(nextOnly: string[]) { + const expected: string[] = []; + const remainingNext: string[] = []; + + for (const item of nextOnly) { + const columnMatch = item.match(/^column:([^:]+):id:/); + const primaryMatch = item.match(/^primary:([^(]+)\(id\)$/); + const table = columnMatch?.[1] ?? primaryMatch?.[1]; + + if (table && syntheticIdTables.has(table)) { + expected.push(`Prisma Next synthetic id for no-id Prisma 6 table: ${item}`); + continue; + } + + remainingNext.push(item); + } + + return { expected, remainingNext }; +} + +function classifyForeignKeyIndexDiffs(nextOnly: string[], foreignKeys: Set) { + const expected: string[] = []; + const remainingNext: string[] = []; + const foreignKeyColumnKeys = new Set(); + + for (const foreignKey of foreignKeys) { + const match = foreignKey.match(/^foreignKey:([^(]+)\(([^)]*)\)->/); + if (match) { + foreignKeyColumnKeys.add(`${match[1]}:${match[2]}`); + } + } + + for (const item of nextOnly) { + const match = item.match(/^index:([^:]+):[^:]+:(.+)$/); + if (match && foreignKeyColumnKeys.has(`${match[1]}:${match[2]}`)) { + expected.push( + `Prisma Next FK-derived index expected while Prisma 6 uses relationMode=prisma: ${item}`, + ); + continue; + } + + remainingNext.push(item); + } + + return { expected, remainingNext }; +} + +async function main() { + const suffix = `${process.pid}_${Date.now()}`; + const prisma6Db = `dub_prisma6_${suffix}`; + const nextDb = `dub_next_${suffix}`; + const adminPool = new Pool({ connectionString: adminDatabaseUrl() }); + + try { + await createDatabase(adminPool, prisma6Db); + await createDatabase(adminPool, nextDb); + + const prisma6Url = databaseUrlFor(prisma6Db); + const nextUrl = databaseUrlFor(nextDb); + + run(["exec", "tsx", "./scripts/prisma6-cli.ts", "db", "push", "--skip-generate"], prisma6Url); + await applyPrismaNextPlannedSql(nextUrl); + + const prisma6 = await snapshot(prisma6Url); + const next = await snapshot(nextUrl); + + const prisma6Only = without(prisma6.items, next.items); + const nextOnly = without(next.items, prisma6.items); + const indexDiffs = classifyIndexSortDiffs(prisma6Only, nextOnly); + const updatedAtTimestampDiffs = classifyUpdatedAtTimestampTypeDiffs( + indexDiffs.remainingPrisma6, + indexDiffs.remainingNext, + ); + const syntheticIdDiffs = classifySyntheticIdDiffs(updatedAtTimestampDiffs.remainingNext); + const foreignKeyIndexDiffs = classifyForeignKeyIndexDiffs( + syntheticIdDiffs.remainingNext, + next.foreignKeys, + ); + + const expected = [ + ...indexDiffs.expected, + ...updatedAtTimestampDiffs.expected, + ...syntheticIdDiffs.expected, + ...foreignKeyIndexDiffs.expected, + ...without(next.foreignKeys, prisma6.foreignKeys).map( + (fk) => `Prisma Next FK DDL expected while Prisma 6 uses relationMode=prisma: ${fk}`, + ), + ].sort(); + const unexpected = [ + ...updatedAtTimestampDiffs.remainingPrisma6.map((item) => `Only in Prisma 6: ${item}`), + ...foreignKeyIndexDiffs.remainingNext.map((item) => `Only in Prisma Next: ${item}`), + ...without(prisma6.foreignKeys, next.foreignKeys).map( + (fk) => `Only in Prisma 6 foreign keys: ${fk}`, + ), + ].sort(); + + console.log(`Expected DDL differences: ${expected.length}`); + for (const diff of expected) { + console.log(` - ${diff}`); + } + + if (unexpected.length > 0) { + console.error(`Unexpected DDL differences: ${unexpected.length}`); + for (const diff of unexpected.slice(0, 200)) { + console.error(` - ${diff}`); + } + if (unexpected.length > 200) { + console.error(` ... ${unexpected.length - 200} more`); + } + process.exitCode = 1; + return; + } + + console.log("No unexpected Prisma Next DDL differences."); + } finally { + await dropDatabase(adminPool, prisma6Db).catch(() => undefined); + await dropDatabase(adminPool, nextDb).catch(() => undefined); + await adminPool.end(); + } +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/prisma/scripts/prisma-next-normalize-contract.ts b/packages/prisma/scripts/prisma-next-normalize-contract.ts new file mode 100644 index 00000000000..96133d76ab3 --- /dev/null +++ b/packages/prisma/scripts/prisma-next-normalize-contract.ts @@ -0,0 +1,74 @@ +import { existsSync, readFileSync, writeFileSync } from "node:fs"; +import { join } from "node:path"; + +const contractPath = join(process.cwd(), "schema", "contract.json"); +const contractTypesPath = join(process.cwd(), "schema", "contract.d.ts"); +const contract = JSON.parse(readFileSync(contractPath, "utf8")) as any; + +function isJsonCodec(value: any) { + if (value?.codecId !== "pg/json@1" && value?.codecId !== "pg/jsonb@1") { + return false; + } + return true; +} + +function normalizeJsonColumn(column: any) { + if (!isJsonCodec(column)) { + return; + } + delete column.typeParams; + delete column.typeRef; +} + +function normalizeJsonStorageType(type: any) { + if (!isJsonCodec(type)) { + return; + } + type.typeParams = {}; +} + +function escapeRegExp(value: string) { + return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + +function normalizeContractTypes() { + if (!existsSync(contractTypesPath)) { + return; + } + + const jsonTypeRefs = Object.entries(contract.storage?.types ?? {}) + .filter(([, type]) => isJsonCodec(type)) + .map(([name]) => name); + + if (jsonTypeRefs.length === 0) { + return; + } + + let contractTypes = readFileSync(contractTypesPath, "utf8"); + for (const typeRef of jsonTypeRefs) { + contractTypes = contractTypes.replace( + new RegExp(`^\\s+readonly typeRef: '${escapeRegExp(typeRef)}';\\n`, "gm"), + "", + ); + } + writeFileSync(contractTypesPath, contractTypes); +} + +for (const table of Object.values(contract.storage?.tables ?? {}) as any[]) { + for (const column of Object.values(table.columns ?? {}) as any[]) { + if (column.default?.kind === "literal" && !("value" in column.default)) { + column.default.value = false; + } + normalizeJsonColumn(column); + } +} + +for (const type of Object.values(contract.storage?.types ?? {}) as any[]) { + if (!("typeParams" in type)) { + type.typeParams = {}; + } + normalizeJsonStorageType(type); +} + +writeFileSync(contractPath, `${JSON.stringify(contract, null, 2)}\n`); +normalizeContractTypes(); diff --git a/packages/prisma/scripts/prisma-next-raw-sql-inventory.mjs b/packages/prisma/scripts/prisma-next-raw-sql-inventory.mjs new file mode 100644 index 00000000000..8adbe38a3f7 --- /dev/null +++ b/packages/prisma/scripts/prisma-next-raw-sql-inventory.mjs @@ -0,0 +1,329 @@ +import { mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs"; +import { dirname, join, relative } from "node:path"; + +const repoRoot = join(process.cwd(), "..", ".."); +const outputPath = + process.env.PRISMA_NEXT_RAW_SQL_INVENTORY_OUT ?? + join(process.cwd(), ".tmp", "prisma-next-raw-sql-inventory.json"); + +const scanRoots = ["apps", "packages"].map((root) => join(repoRoot, root)); +const sourceExtensions = new Set([ + ".ts", + ".tsx", + ".js", + ".jsx", + ".mjs", + ".cjs", +]); +const ignoredPathParts = new Set([ + "node_modules", + ".next", + "dist", + "build", + "coverage", +]); +const ignoredRelativePaths = new Set([ + "packages/prisma/scripts/prisma-next-runtime-sql-compare.mjs", +]); + +const executionPatterns = [ + { kind: "prisma-query-raw", pattern: /\.\$queryRaw(?:Unsafe)?\b/g }, + { kind: "prisma-execute-raw", pattern: /\.\$executeRaw(?:Unsafe)?\b/g }, + { kind: "postgres-helper-execute", pattern: /\bconn\.execute\s*\(/g }, +]; + +const fragmentPatterns = [ + { kind: "prisma-sql-fragment", pattern: /\bPrisma\.sql`/g }, + { kind: "prisma-join-fragment", pattern: /\bPrisma\.join\s*\(/g }, + { kind: "prisma-raw-fragment", pattern: /\bPrisma\.raw\s*\(/g }, +]; + +function walk(dir, files = []) { + for (const entry of readdirSync(dir, { withFileTypes: true })) { + if (ignoredPathParts.has(entry.name) || entry.isSymbolicLink()) { + continue; + } + + const fullPath = join(dir, entry.name); + if (entry.isDirectory()) { + walk(fullPath, files); + continue; + } + + const extension = fullPath.slice(fullPath.lastIndexOf(".")); + if (sourceExtensions.has(extension)) { + files.push(fullPath); + } + } + return files; +} + +function lineAndColumn(source, index) { + const before = source.slice(0, index); + const lines = before.split("\n"); + return { + line: lines.length, + column: lines.at(-1).length + 1, + }; +} + +function contextSnippet(source, index) { + const before = source.slice(0, index).split("\n"); + const contextLineCount = 4; + const contextStartLine = Math.max(0, before.length - contextLineCount - 1); + const lineStarts = []; + let cursor = 0; + for (const line of source.split("\n")) { + lineStarts.push(cursor); + cursor += line.length + 1; + } + + const start = lineStarts[contextStartLine] ?? 0; + const statementEnd = source.indexOf(";", index); + const end = + statementEnd === -1 + ? Math.min(source.length, index + 4_000) + : statementEnd + 1; + return source.slice(start, Math.min(end, index + 8_000)); +} + +function lineWindowSnippet(source, index) { + const lines = source.split("\n"); + const { line } = lineAndColumn(source, index); + const start = Math.max(0, line - 8); + const end = Math.min(lines.length, line + 80); + return lines.slice(start, end).join("\n"); +} + +function detectFeatures(snippet) { + const lower = snippet.toLowerCase(); + const features = []; + const checks = [ + ["cte", /\bwith\b/], + ["join", /\bjoin\b/], + ["group-by", /\bgroup\s+by\b/], + ["order-by", /\border\s+by\b/], + ["aggregate", /\b(count|sum|avg|min|max|array_agg|string_agg)\s*\(/], + ["date-bucketing", /\b(to_char|date_trunc)\s*\(|\bat\s+time\s+zone\b/], + ["json", /\bjsonb?[_\s(]|->>|->/], + ["exists", /\bexists\s*\(/], + ["case", /\bcase\b/], + ["union", /\bunion\b/], + ["window", /\bover\s*\(/], + ["dynamic-list", /\bprisma\.join\s*\(/], + ["dynamic-sql", /\bprisma\.raw\s*\(/], + ["unsafe-raw", /\$queryrawunsafe|\$executerawunsafe/], + ["ilike", /\bilike\b/], + ["delete", /\bdelete\s+from\b/], + ["update", /\bupdate\s+["\w.]+\s+set\b/], + ["insert", /\binsert\s+into\b/], + ["select-star", /\bselect\s+\*/], + ]; + + for (const [feature, pattern] of checks) { + if (pattern.test(lower)) { + features.push(feature); + } + } + + return features; +} + +function classifyUsage(kind, snippet, features) { + if (features.includes("unsafe-raw") || features.includes("dynamic-sql")) { + return { + supportedBy: "manual-review", + confidence: "low", + reason: + "Uses unsafe or dynamic raw SQL construction; exact Prisma Next coverage depends on the constructed SQL.", + }; + } + + if ( + kind === "postgres-helper-execute" && + !/conn\.execute\s*\(\s*`/m.test(snippet) + ) { + return { + supportedBy: "manual-review", + confidence: "low", + reason: + "The SQL is passed through a variable or non-template call; static classification cannot see the full query.", + }; + } + + const complexFeatures = [ + "cte", + "date-bucketing", + "json", + "case", + "union", + "window", + "dynamic-list", + ]; + const hasComplexFeature = complexFeatures.some((feature) => + features.includes(feature), + ); + if (hasComplexFeature) { + return { + supportedBy: "not-currently-covered", + confidence: "medium", + reason: + "Uses SQL constructs that are outside the current high-level ORM surface and should not be assumed to lower through the current SQL builder without a dedicated port.", + }; + } + + if ( + features.includes("join") || + features.includes("group-by") || + features.includes("aggregate") + ) { + return { + supportedBy: "query-builder-api", + confidence: "medium", + reason: + "Uses relational SQL shape beyond simple model CRUD; candidate for Prisma Next lower-level SQL builder or ORM aggregate/grouping after a focused port.", + }; + } + + if ( + features.includes("delete") || + features.includes("update") || + features.includes("insert") + ) { + return { + supportedBy: "orm-api", + confidence: "medium", + reason: + "Looks like single-table write SQL that maps to ORM create/update/delete APIs.", + }; + } + + if (/select\b/i.test(snippet)) { + return { + supportedBy: "orm-api", + confidence: "medium", + reason: + "Looks like a single-table read/filter query that maps to ORM where/select/order/take APIs.", + }; + } + + return { + supportedBy: "manual-review", + confidence: "low", + reason: + "The execution site is raw SQL, but the local snippet does not expose enough SQL shape.", + }; +} + +function collectMatches(file, source, patternDefinitions) { + const matches = []; + + for (const definition of patternDefinitions) { + definition.pattern.lastIndex = 0; + let match; + while ((match = definition.pattern.exec(source)) !== null) { + const location = lineAndColumn(source, match.index); + let snippet = contextSnippet(source, match.index); + let features = detectFeatures(snippet); + + if ( + features.length === 0 && + definition.kind !== "postgres-helper-execute" && + source.slice(match.index, match.index + 2_000).includes("`") + ) { + snippet = lineWindowSnippet(source, match.index); + features = detectFeatures(snippet); + } + + matches.push({ + kind: definition.kind, + file: relative(repoRoot, file), + line: location.line, + column: location.column, + snippet, + features, + classification: + patternDefinitions === executionPatterns + ? classifyUsage(definition.kind, snippet, features) + : undefined, + }); + } + } + + return matches; +} + +function summarize(executions) { + const bySupport = new Map(); + const byKind = new Map(); + const byFeature = new Map(); + + for (const execution of executions) { + const support = execution.classification.supportedBy; + bySupport.set(support, (bySupport.get(support) ?? 0) + 1); + byKind.set(execution.kind, (byKind.get(execution.kind) ?? 0) + 1); + for (const feature of execution.features) { + byFeature.set(feature, (byFeature.get(feature) ?? 0) + 1); + } + } + + const toObject = (map) => + Object.fromEntries( + [...map.entries()].sort(([left], [right]) => left.localeCompare(right)), + ); + + return { + totalExecutionSites: executions.length, + bySupport: toObject(bySupport), + byKind: toObject(byKind), + byFeature: toObject(byFeature), + }; +} + +function main() { + const files = scanRoots + .flatMap((root) => walk(root)) + .filter((file) => !ignoredRelativePaths.has(relative(repoRoot, file))); + const executions = []; + const fragments = []; + + for (const file of files) { + const source = readFileSync(file, "utf8"); + executions.push(...collectMatches(file, source, executionPatterns)); + fragments.push(...collectMatches(file, source, fragmentPatterns)); + } + + const report = { + generatedAt: new Date().toISOString(), + strategy: { + scope: + "Static inventory of raw SQL execution sites in apps/ and packages/, excluding this branch's Prisma Next comparison harness. Prisma.sql fragments are counted separately from executed raw SQL calls.", + classification: + "Conservative heuristic: simple model CRUD is classified as ORM API; joins/aggregates as lower-level query builder candidates; CTEs/date bucketing/JSON/window/dynamic SQL as not currently covered or manual review.", + }, + summary: summarize(executions), + executions, + fragments: { + total: fragments.length, + byKind: summarize( + fragments.map((fragment) => ({ + ...fragment, + classification: { supportedBy: "fragment" }, + })), + ).byKind, + items: fragments, + }, + }; + + mkdirSync(dirname(outputPath), { recursive: true }); + writeFileSync(outputPath, `${JSON.stringify(report, null, 2)}\n`); + + console.log(`Raw SQL execution sites: ${report.summary.totalExecutionSites}`); + for (const [support, count] of Object.entries(report.summary.bySupport)) { + console.log(` - ${support}: ${count}`); + } + console.log(`Prisma SQL fragments: ${report.fragments.total}`); + console.log(`Raw SQL inventory written to ${outputPath}`); +} + +main(); diff --git a/packages/prisma/scripts/prisma-next-runtime-sql-compare.mjs b/packages/prisma/scripts/prisma-next-runtime-sql-compare.mjs new file mode 100644 index 00000000000..fca70f06439 --- /dev/null +++ b/packages/prisma/scripts/prisma-next-runtime-sql-compare.mjs @@ -0,0 +1,5072 @@ +import postgres from "@prisma-next/postgres/runtime"; +import { and } from "@prisma-next/sql-orm-client"; +import { PrismaPg } from "@prisma/adapter-pg"; +import { PrismaClient } from "@prisma/client"; +import { createHash } from "node:crypto"; +import { mkdirSync, writeFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { Pool } from "pg"; +import contractJson from "../schema/contract.json" with { type: "json" }; + +const baseDatabaseUrl = + process.env.DATABASE_URL ?? + "postgresql://postgres:postgres@localhost:5432/dub"; +const prisma6RootDatabaseUrl = + process.env.PRISMA6_DATABASE_URL ?? baseDatabaseUrl; +const prismaNextRootDatabaseUrl = + process.env.PRISMA_NEXT_DATABASE_URL ?? baseDatabaseUrl; + +const outputPath = + process.env.PRISMA_NEXT_SQL_COMPARE_OUT ?? + join(process.cwd(), ".tmp", "prisma-next-runtime-sql-comparison.json"); + +const dashboardIds = { + existing: "dash_runtime_sql_existing", + create: "dash_runtime_sql_create", +}; + +const fixtureValues = { + bountyId: "bounty_runtime_sql", + bountyGroupId: "bounty_group_runtime_sql", + bountySubmissionId: "bounty_submission_runtime_sql", + bountySubmissionSecondId: "bounty_submission_second_runtime_sql", + domainId: "domain_runtime_sql", + integrationId: "integration_runtime_sql", + installedIntegrationId: "installed_integration_runtime_sql", + linkId: "link_runtime_sql", + folderId: "fold_runtime_sql", + customerId: "customer_runtime_sql", + commissionId: "commission_runtime_sql", + commissionProcessedId: "commission_processed_runtime_sql", + invoiceId: "invoice_runtime_sql", + campaignId: "campaign_runtime_sql", + notificationEmailId: "notification_email_runtime_sql", + notificationEmailOpenedId: "notification_email_opened_runtime_sql", + partnerId: "partner_runtime_sql", + postbackId: "postback_runtime_sql", + postbackDisabledId: "postback_disabled_runtime_sql", + payoutId: "payout_runtime_sql", + payoutPendingId: "payout_pending_runtime_sql", + programApplicationId: "program_application_runtime_sql", + programApplicationEventId: "program_application_event_runtime_sql", + programApplicationEventSecondId: + "program_application_event_second_runtime_sql", + programEnrollmentId: "program_enrollment_runtime_sql", + partnerGroupId: "partner_group_runtime_sql", + programWorkspaceId: "proj_runtime_sql_program", + programWorkspaceSlug: "runtime-sql-program-workspace", + programId: "prog_runtime_sql", + projectId: "proj_runtime_sql", + projectSlug: "runtime-sql-project", + restrictedTokenId: "restricted_token_runtime_sql", + tagId: "tag_runtime_sql", + tagCreateId: "tag_runtime_sql_create", + userId: "user_runtime_sql", + webhookId: "webhook_runtime_sql", + workflowId: "workflow_runtime_sql", +}; + +const edgeLinkScalarFields = [ + "id", + "domain", + "key", + "url", + "shortLink", + "proxy", + "title", + "description", + "image", + "video", + "rewrite", + "password", + "expiresAt", + "ios", + "android", + "geo", + "projectId", + "publicStats", + "expiredUrl", + "createdAt", + "trackConversion", + "programId", + "partnerId", +]; + +const edgeWorkspaceScalarFields = [ + "id", + "name", + "slug", + "logo", + "defaultProgramId", + "plan", + "stripeId", + "billingCycleStart", + "totalLinks", + "totalClicks", + "usage", + "usageLimit", + "linksUsage", + "createdAt", +]; + +const selectFields = (fields) => + Object.fromEntries(fields.map((field) => [field, true])); + +const quoteIdent = (value) => `"${value.replace(/"/g, '""')}"`; + +const databaseUrlFor = (rootDatabaseUrl, databaseName) => { + const url = new URL(rootDatabaseUrl); + url.pathname = `/${databaseName}`; + return url.toString(); +}; + +const adminDatabaseUrlFor = (rootDatabaseUrl) => { + const url = new URL(rootDatabaseUrl); + url.pathname = "/postgres"; + return url.toString(); +}; + +const describeDatabaseUrl = (databaseUrl) => { + const url = new URL(databaseUrl); + const username = url.username ? decodeURIComponent(url.username) : ""; + const auth = username + ? `${username}${url.password ? ":" : ""}@` + : ""; + return `${url.protocol}//${auth}${url.host}${url.pathname}`; +}; + +const normalizeSql = (sql) => String(sql).replace(/\s+/g, " ").trim(); + +const stableJson = (value) => + JSON.stringify( + value, + (_key, current) => { + if (typeof current === "bigint") { + return current.toString(); + } + return current; + }, + 2, + ); + +function describeValue(value, depth = 0) { + if (value === null) { + return { kind: "null" }; + } + if (value === undefined) { + return { kind: "undefined" }; + } + if (value instanceof Date) { + return { + kind: "date", + constructor: "Date", + iso: Number.isNaN(value.getTime()) ? null : value.toISOString(), + }; + } + if (Buffer.isBuffer(value)) { + return { + kind: "buffer", + constructor: "Buffer", + byteLength: value.byteLength, + }; + } + if (Array.isArray(value)) { + return { + kind: "array", + constructor: "Array", + length: value.length, + items: + depth >= 3 + ? [] + : value.slice(0, 5).map((item) => describeValue(item, depth + 1)), + }; + } + const type = typeof value; + if (type !== "object") { + return { + kind: type, + value, + }; + } + + const constructor = value?.constructor?.name ?? "Object"; + const entries = Object.entries(value); + return { + kind: "object", + constructor, + keys: entries.map(([key]) => key), + fields: + depth >= 3 + ? undefined + : Object.fromEntries( + entries.map(([key, fieldValue]) => [ + key, + describeValue(fieldValue, depth + 1), + ]), + ), + }; +} + +function summarizeParams(params) { + return params.map((value, index) => ({ + index, + ...describeValue(value), + })); +} + +function summarizeResult(result) { + return describeValue(result); +} + +function stableHash(value) { + return createHash("sha256").update(stableJson(value)).digest("hex"); +} + +function typeShape(summary) { + if (!summary || typeof summary !== "object") { + return summary; + } + + const base = { + kind: summary.kind, + ...(summary.constructor ? { constructor: summary.constructor } : {}), + }; + + if (summary.kind === "array") { + return { + ...base, + items: (summary.items ?? []).map(typeShape), + }; + } + + if (summary.kind === "object") { + const fields = summary.fields ?? {}; + return { + ...base, + keys: [...(summary.keys ?? [])].sort(), + fields: Object.fromEntries( + Object.entries(fields) + .sort(([left], [right]) => left.localeCompare(right)) + .map(([key, value]) => [key, typeShape(value)]), + ), + }; + } + + return base; +} + +function summarizeQuery(entry) { + return { + sql: entry.sql, + normalizedSql: normalizeSql(entry.sql), + params: summarizeParams(entry.params ?? []), + meta: entry.meta, + }; +} + +class QueryCollector { + #enabled = false; + + constructor(label) { + this.label = label; + this.entries = []; + this.queryEvents = []; + } + + get enabled() { + return this.#enabled; + } + + start() { + this.entries = []; + this.queryEvents = []; + this.#enabled = true; + } + + stop() { + this.#enabled = false; + } + + record(entry) { + if (!this.#enabled) { + return; + } + this.entries.push(entry); + } + + recordQueryEvent(event) { + if (!this.#enabled) { + return; + } + this.queryEvents.push({ + query: event.query, + params: event.params, + duration: event.duration, + target: event.target, + }); + } +} + +const capturedClientSymbol = Symbol("dub.runtimeSqlCapturedClient"); + +function extractQueryInput(queryConfig, values) { + const sql = + typeof queryConfig === "string" + ? queryConfig + : typeof queryConfig?.text === "string" + ? queryConfig.text + : null; + const params = Array.isArray(values) + ? values + : Array.isArray(queryConfig?.values) + ? queryConfig.values + : []; + + return { sql, params }; +} + +class CapturingPool extends Pool { + constructor(config, collector) { + super(config); + this.collector = collector; + } + + connect(callback) { + const wrapClient = (client) => { + if (!client || client[capturedClientSymbol]) { + return client; + } + + const originalQuery = client.query.bind(client); + client.query = (queryConfig, values, queryCallback) => { + const { sql, params } = extractQueryInput(queryConfig, values); + if (sql) { + this.collector.record({ sql, params }); + } + return originalQuery(queryConfig, values, queryCallback); + }; + Object.defineProperty(client, capturedClientSymbol, { + value: true, + }); + return client; + }; + + if (typeof callback === "function") { + return super.connect((error, client, done) => { + callback(error, wrapClient(client), done); + }); + } + + return super.connect().then(wrapClient); + } +} + +async function createDatabase(pool, name) { + await pool.query(`CREATE DATABASE ${quoteIdent(name)}`); +} + +async function dropDatabase(pool, name) { + await pool.query( + "select pg_terminate_backend(pid) from pg_stat_activity where datname = $1", + [name], + ); + await pool.query(`DROP DATABASE IF EXISTS ${quoteIdent(name)}`); +} + +async function createRuntimeComparisonSchema(pool) { + await pool.query("create schema if not exists prisma_contract"); + await pool.query(` + create table prisma_contract.marker ( + space text not null primary key default 'app', + core_hash text not null, + profile_hash text not null, + contract_json jsonb, + canonical_version int, + updated_at timestamptz not null default now(), + app_tag text, + meta jsonb not null default '{}', + invariants text[] not null default '{}' + ) + `); + await pool.query(` + create table "User" ( + "id" text primary key, + "name" text, + "image" text, + "isMachine" boolean not null default false + ) + `); + await pool.query(` + create table "Project" ( + "id" text primary key, + "name" text, + "slug" text unique, + "logo" text, + "defaultProgramId" text unique, + "plan" text not null default 'pro', + "stripeId" text, + "billingCycleStart" integer not null default 1, + "totalLinks" integer not null default 0, + "totalClicks" integer not null default 0, + "usage" integer not null default 0, + "usageLimit" integer not null default 1000, + "linksUsage" integer not null default 0, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "Link" ( + "id" text primary key, + "domain" text not null, + "key" text not null, + "url" text not null, + "shortLink" varchar(400), + "archived" boolean not null default false, + "expiresAt" timestamp(3), + "expiredUrl" text, + "disabledAt" timestamp(3), + "password" text, + "trackConversion" boolean not null default false, + "proxy" boolean not null default false, + "title" text, + "description" varchar(280), + "image" text, + "video" text, + "rewrite" boolean not null default false, + "ios" text, + "android" text, + "geo" jsonb, + "folderId" text, + "projectId" text, + "userId" text, + "programId" text, + "partnerId" text, + "externalId" text, + "tenantId" text, + "publicStats" boolean not null default false, + "clicks" integer not null default 0, + "leads" integer not null default 0, + "conversions" integer not null default 0, + "sales" integer not null default 0, + "saleAmount" bigint not null default 0, + "lastClicked" timestamp(3), + "lastLeadAt" timestamp(3), + "lastConversionAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "comments" text, + "partnerGroupDefaultLinkId" text, + unique ("shortLink"), + unique ("domain", "key") + ) + `); + await pool.query(` + create table "Folder" ( + "id" text primary key, + "name" text not null, + "description" text, + "projectId" text, + "type" text not null default 'default', + "accessLevel" text, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "FolderUser" ( + "id" text primary key, + "folderId" text not null, + "userId" text not null, + "role" text, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("folderId", "userId") + ) + `); + await pool.query(` + create table "ProjectUsers" ( + "id" text primary key, + "role" text not null default 'member', + "userId" text not null, + "projectId" text not null, + "workspacePreferences" jsonb, + "defaultFolderId" text, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("userId", "projectId") + ) + `); + await pool.query(` + create table "Integration" ( + "id" text primary key, + "userId" text, + "projectId" text not null, + "name" text not null, + "slug" text unique not null, + "developer" text not null, + "website" text not null, + "verified" boolean not null default false, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "InstalledIntegration" ( + "id" text primary key, + "userId" text not null, + "integrationId" text not null, + "projectId" text not null, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "credentials" jsonb, + "settings" jsonb, + unique ("userId", "integrationId", "projectId") + ) + `); + await pool.query(` + create table "Tag" ( + "id" text primary key, + "name" text not null, + "color" text not null default 'blue', + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "projectId" text not null, + unique ("name", "projectId") + ) + `); + await pool.query(` + create table "LinkTag" ( + "id" text primary key, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "linkId" text not null, + "tagId" text not null, + unique ("linkId", "tagId") + ) + `); + await pool.query(` + create table "RestrictedToken" ( + "id" text primary key, + "name" text not null, + "hashedKey" text unique not null, + "partialKey" text not null, + "scopes" text, + "expires" timestamp(3), + "lastUsed" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "userId" text not null, + "projectId" text not null, + "installationId" text + ) + `); + await pool.query(` + create table "OAuthRefreshToken" ( + "id" text primary key, + "installationId" text not null, + "accessTokenId" text not null, + "hashedRefreshToken" text unique not null, + "expiresAt" timestamp(3) not null, + "createdAt" timestamp(3) not null default current_timestamp + ) + `); + await pool.query(` + create table "Webhook" ( + "id" text primary key, + "projectId" text not null, + "installationId" text, + "receiver" text not null default 'user', + "name" text not null, + "url" text not null, + "secret" text not null, + "triggers" jsonb not null, + "consecutiveFailures" integer not null default 0, + "lastFailedAt" timestamp(3), + "disabledAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "LinkWebhook" ( + "id" text primary key, + "linkId" text not null, + "webhookId" text not null, + unique ("linkId", "webhookId") + ) + `); + await pool.query(` + create table "Domain" ( + "id" text primary key, + "slug" text unique not null, + "verified" boolean not null default false, + "placeholder" text, + "expiredUrl" text, + "notFoundUrl" text, + "primary" boolean not null default false, + "archived" boolean not null default false, + "lastChecked" timestamp(3) not null default current_timestamp, + "logo" text, + "appleAppSiteAssociation" jsonb, + "assetLinks" jsonb, + "deepviewData" jsonb, + "linkRetentionDays" integer, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "projectId" text + ) + `); + await pool.query(` + create table "RegisteredDomain" ( + "id" text primary key, + "slug" text not null, + "projectId" text not null, + "domainId" text unique, + "autoRenewalDisabledAt" timestamp(3), + "renewalFee" integer not null default 1200, + "expiresAt" timestamp(3) not null, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "Program" ( + "id" text primary key, + "workspaceId" text not null, + "defaultFolderId" text not null, + "defaultGroupId" text not null, + "name" text not null, + "slug" text unique not null, + "domain" text unique, + "url" text, + "logo" text, + "description" text, + "primaryRewardEvent" text not null default 'sale', + "minPayoutAmount" integer not null default 0, + "payoutMode" text not null default 'internal', + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "addedToMarketplaceAt" timestamp(3) + ) + `); + await pool.query(` + create type "Category" as enum ( + 'Artificial_Intelligence', + 'Development', + 'Design', + 'Productivity', + 'Finance', + 'Marketing', + 'Ecommerce', + 'Security', + 'Education', + 'Health', + 'Consumer' + ) + `); + await pool.query(` + create table "ProgramCategory" ( + "programId" text not null, + "category" "Category" not null, + unique ("programId", "category") + ) + `); + await pool.query(` + create table "PartnerGroup" ( + "id" text primary key, + "programId" text not null, + "name" text not null, + "slug" text not null, + "color" text, + "clickRewardId" text unique, + "leadRewardId" text unique, + "saleRewardId" text unique, + "discountId" text unique, + "linkStructure" text not null default 'short', + "additionalLinks" jsonb, + "maxPartnerLinks" integer not null default 0, + "applicationFormData" jsonb, + "applicationFormPublishedAt" timestamp(3), + "landerData" jsonb, + "landerPublishedAt" timestamp(3), + "logo" text, + "wordmark" text, + "brandColor" text, + "holdingPeriodDays" integer not null default 0, + "autoApprovePartnersEnabledAt" timestamp(3), + "workflowId" text unique, + "utmTemplateId" text unique, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("programId", "slug") + ) + `); + await pool.query(` + create table "Partner" ( + "id" text primary key, + "name" text not null, + "username" text unique, + "companyName" text, + "profileType" text not null default 'individual', + "email" text unique, + "image" text, + "description" text, + "country" text, + "payoutsEnabledAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create type "ProgramEnrollmentStatus" as enum ( + 'pending', + 'approved', + 'rejected', + 'invited', + 'declined', + 'deactivated', + 'banned', + 'archived' + ) + `); + await pool.query(` + create table "ProgramEnrollment" ( + "id" text primary key, + "partnerId" text not null, + "programId" text not null, + "tenantId" text, + "groupId" text, + "status" "ProgramEnrollmentStatus" not null default 'pending', + "totalClicks" integer not null default 0, + "totalLeads" integer not null default 0, + "totalConversions" integer not null default 0, + "totalSales" integer not null default 0, + "totalSaleAmount" bigint not null default 0, + "totalCommissions" bigint not null default 0, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("partnerId", "programId"), + unique ("tenantId", "programId") + ) + `); + await pool.query(` + create type "CommissionStatus" as enum ( + 'pending', + 'processed', + 'paid', + 'refunded', + 'duplicate', + 'fraud', + 'canceled' + ) + `); + await pool.query(` + create type "CommissionType" as enum ( + 'click', + 'lead', + 'sale', + 'custom' + ) + `); + await pool.query(` + create type "PayoutStatus" as enum ( + 'pending', + 'processing', + 'processed', + 'sent', + 'completed', + 'failed', + 'canceled' + ) + `); + await pool.query(` + create type "PayoutMode" as enum ( + 'internal', + 'external' + ) + `); + await pool.query(` + create type "PartnerPayoutMethod" as enum ( + 'connect', + 'stablecoin', + 'paypal' + ) + `); + await pool.query(` + create type "InvoiceStatus" as enum ( + 'processing', + 'completed', + 'failed' + ) + `); + await pool.query(` + create type "InvoiceType" as enum ( + 'partnerPayout', + 'domainRenewal' + ) + `); + await pool.query(` + create type "ProgramPayoutMode" as enum ( + 'internal', + 'hybrid', + 'external' + ) + `); + await pool.query(` + create type "PaymentMethod" as enum ( + 'card', + 'ach', + 'ach_fast', + 'sepa', + 'acss' + ) + `); + await pool.query(` + create table "Invoice" ( + "id" text primary key, + "programId" text, + "workspaceId" text not null, + "number" text unique, + "status" "InvoiceStatus" not null default 'processing', + "type" "InvoiceType" not null default 'partnerPayout', + "payoutMode" "ProgramPayoutMode" not null default 'internal', + "paymentMethod" "PaymentMethod", + "amount" integer not null default 0, + "fee" integer not null default 0, + "total" integer not null default 0, + "externalAmount" integer not null default 0, + "receiptUrl" text, + "failedReason" text, + "registeredDomains" jsonb, + "stripeChargeMetadata" jsonb, + "failedAttempts" integer not null default 0, + "createdAt" timestamp(3) not null default current_timestamp, + "paidAt" timestamp(3) + ) + `); + await pool.query(` + create table "Payout" ( + "id" text primary key, + "programId" text not null, + "partnerId" text not null, + "invoiceId" text, + "amount" integer not null default 0, + "currency" text not null default 'USD', + "status" "PayoutStatus" not null default 'pending', + "mode" "PayoutMode", + "method" "PartnerPayoutMethod", + "description" text, + "periodStart" timestamp(3), + "periodEnd" timestamp(3), + "paypalTransferId" text unique, + "stripeTransferId" text, + "stripePayoutId" text, + "stripePayoutTraceId" text, + "failureReason" text, + "webhookEventId" text unique, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + "userId" text, + "initiatedAt" timestamp(3), + "paidAt" timestamp(3) + ) + `); + await pool.query(` + create table "Commission" ( + "id" text primary key, + "programId" text not null, + "partnerId" text not null, + "rewardId" text, + "linkId" text, + "payoutId" text, + "invoiceId" text, + "customerId" text, + "eventId" text unique, + "description" text, + "type" "CommissionType" not null, + "amount" integer not null, + "quantity" integer not null, + "earnings" integer not null default 0, + "currency" text not null default 'usd', + "status" "CommissionStatus" not null default 'pending', + "userId" text, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("invoiceId", "programId") + ) + `); + await pool.query(` + create type "ProgramApplicationRejectionReason" as enum ( + 'needsMoreDetail', + 'doesNotMeetRequirements', + 'notTheRightFit', + 'other' + ) + `); + await pool.query(` + create table "ProgramApplication" ( + "id" text primary key, + "programId" text not null, + "groupId" text, + "name" text not null, + "email" text not null, + "country" text, + "website" text, + "youtube" text, + "twitter" text, + "linkedin" text, + "instagram" text, + "tiktok" text, + "formData" jsonb, + "userId" text, + "rejectionReason" "ProgramApplicationRejectionReason", + "rejectionNote" text, + "reviewedAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "ProgramApplicationEvent" ( + "id" text primary key, + "programId" text not null, + "visitedAt" timestamp(3) not null default current_timestamp, + "startedAt" timestamp(3), + "submittedAt" timestamp(3), + "approvedAt" timestamp(3), + "rejectedAt" timestamp(3), + "country" text, + "referralSource" text not null, + "referredByPartnerId" text, + "metadata" jsonb, + "programApplicationId" text, + "partnerId" text, + unique ("programId", "partnerId") + ) + `); + await pool.query(` + create type "WorkflowTrigger" as enum ( + 'partnerEnrolled', + 'partnerMetricsUpdated', + 'clickRecorded', + 'commissionEarned', + 'leadRecorded', + 'saleRecorded' + ) + `); + await pool.query(` + create table "Workflow" ( + "id" text primary key, + "programId" text not null, + "name" text, + "trigger" "WorkflowTrigger" not null, + "triggerConditions" jsonb not null, + "actions" jsonb not null, + "disabledAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create type "BountyType" as enum ( + 'performance', + 'submission' + ) + `); + await pool.query(` + create type "BountyPerformanceScope" as enum ( + 'new', + 'lifetime' + ) + `); + await pool.query(` + create type "BountySubmissionStatus" as enum ( + 'draft', + 'submitted', + 'approved', + 'rejected' + ) + `); + await pool.query(` + create type "BountySubmissionRejectionReason" as enum ( + 'invalidProof', + 'duplicateSubmission', + 'outOfTimeWindow', + 'didNotMeetCriteria', + 'other' + ) + `); + await pool.query(` + create type "BountySubmissionFrequency" as enum ( + 'day', + 'week', + 'month' + ) + `); + await pool.query(` + create table "Bounty" ( + "id" text primary key, + "programId" text not null, + "workflowId" text unique, + "name" text not null, + "description" text, + "type" "BountyType" not null, + "startsAt" timestamp(3) not null, + "endsAt" timestamp(3), + "submissionsOpenAt" timestamp(3), + "submissionFrequency" "BountySubmissionFrequency", + "maxSubmissions" integer not null default 1, + "rewardAmount" integer, + "rewardDescription" text, + "performanceScope" "BountyPerformanceScope", + "submissionRequirements" jsonb, + "socialMetricsLastSyncedAt" timestamp(3), + "archivedAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "BountyGroup" ( + "id" text primary key, + "bountyId" text not null, + "groupId" text not null, + unique ("bountyId", "groupId") + ) + `); + await pool.query(` + create table "BountySubmission" ( + "id" text primary key, + "programId" text not null, + "partnerId" text not null, + "bountyId" text not null, + "performanceCount" bigint, + "socialMetricCount" integer, + "commissionId" text unique, + "userId" text, + "description" text, + "status" "BountySubmissionStatus" not null default 'draft', + "rejectionReason" "BountySubmissionRejectionReason", + "rejectionNote" text, + "files" jsonb, + "urls" jsonb, + "periodNumber" integer not null default 1, + "socialMetricsLastSyncedAt" timestamp(3), + "completedAt" timestamp(3), + "reviewedAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("bountyId", "partnerId", "periodNumber") + ) + `); + await pool.query(` + create type "NotificationEmailType" as enum ( + 'Message', + 'Bounty', + 'Campaign' + ) + `); + await pool.query(` + create table "NotificationEmail" ( + "id" text primary key, + "emailId" text unique not null, + "type" "NotificationEmailType" not null, + "messageId" text, + "bountyId" text, + "campaignId" text, + "programId" text, + "partnerId" text, + "recipientUserId" text, + "deliveredAt" timestamp(3), + "openedAt" timestamp(3), + "bouncedAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp + ) + `); + await pool.query(` + create type "PostbackReceiver" as enum ( + 'custom', + 'slack' + ) + `); + await pool.query(` + create table "Postback" ( + "id" text primary key, + "partnerId" text not null, + "name" text not null, + "url" text not null, + "secret" text not null, + "triggers" jsonb not null, + "receiver" "PostbackReceiver" not null, + "disabledAt" timestamp(3), + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); + await pool.query(` + create table "Customer" ( + "id" text primary key, + "name" text, + "email" text, + "avatar" text, + "externalId" text, + "stripeCustomerId" text unique, + "linkId" text, + "clickId" text, + "clickedAt" timestamp(3), + "country" text, + "sales" integer not null default 0, + "saleAmount" bigint not null default 0, + "projectId" text not null, + "projectConnectId" text, + "programId" text, + "partnerId" text, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null, + unique ("projectId", "externalId"), + unique ("projectConnectId", "externalId") + ) + `); + await pool.query(` + create table "Dashboard" ( + "id" text primary key, + "linkId" text unique, + "folderId" text unique, + "projectId" text, + "userId" text, + "doIndex" boolean not null default false, + "password" text, + "showConversions" boolean not null default false, + "createdAt" timestamp(3) not null default current_timestamp, + "updatedAt" timestamp(3) not null + ) + `); +} + +async function resetRuntimeFixture(pool, options = {}) { + const { includeDashboard = true } = options; + await pool.query( + 'truncate table "Dashboard", "Customer", "Postback", "NotificationEmail", "BountySubmission", "BountyGroup", "Bounty", "Workflow", "ProgramApplicationEvent", "ProgramApplication", "Commission", "Payout", "Invoice", "ProgramEnrollment", "Partner", "PartnerGroup", "ProgramCategory", "Program", "RegisteredDomain", "Domain", "LinkWebhook", "Webhook", "OAuthRefreshToken", "RestrictedToken", "LinkTag", "Tag", "InstalledIntegration", "Integration", "FolderUser", "ProjectUsers", "Link", "Folder", "Project", "User"', + ); + await pool.query( + 'insert into "User" ("id", "name", "image", "isMachine") values ($1, $2, $3, $4)', + [ + fixtureValues.userId, + "Runtime SQL User", + "https://example.com/avatar.png", + false, + ], + ); + await pool.query( + 'insert into "Project" ("id", "name", "slug", "logo", "defaultProgramId", "plan", "stripeId", "billingCycleStart", "totalLinks", "totalClicks", "usage", "usageLimit", "linksUsage", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)', + [ + fixtureValues.projectId, + "Runtime SQL Project", + fixtureValues.projectSlug, + "https://example.com/logo.png", + null, + "pro", + "sub_runtime_sql", + 7, + 1, + 10, + 25, + 1000, + 1, + new Date("2024-01-03T00:00:00.000Z"), + new Date("2024-01-03T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Project" ("id", "name", "slug", "logo", "defaultProgramId", "plan", "stripeId", "billingCycleStart", "totalLinks", "totalClicks", "usage", "usageLimit", "linksUsage", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)', + [ + fixtureValues.programWorkspaceId, + "Runtime SQL Program Workspace", + fixtureValues.programWorkspaceSlug, + null, + fixtureValues.programId, + "business", + null, + 1, + 0, + 3, + 9, + 5000, + 0, + new Date("2024-01-04T00:00:00.000Z"), + new Date("2024-01-04T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Program" ("id", "workspaceId", "defaultFolderId", "defaultGroupId", "name", "slug", "domain", "url", "logo", "description", "primaryRewardEvent", "minPayoutAmount", "payoutMode", "createdAt", "updatedAt", "addedToMarketplaceAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)', + [ + fixtureValues.programId, + fixtureValues.programWorkspaceId, + fixtureValues.folderId, + fixtureValues.partnerGroupId, + "Runtime SQL Program", + "runtime-sql-program", + null, + "https://example.com/program", + null, + "Runtime SQL program", + "sale", + 1000, + "internal", + new Date("2024-01-04T02:00:00.000Z"), + new Date("2024-01-04T02:00:00.000Z"), + new Date("2024-01-04T03:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "ProgramCategory" ("programId", "category") values ($1, $2)', + [fixtureValues.programId, "Development"], + ); + await pool.query( + 'insert into "PartnerGroup" ("id", "programId", "name", "slug", "color", "clickRewardId", "leadRewardId", "saleRewardId", "discountId", "applicationFormPublishedAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)', + [ + fixtureValues.partnerGroupId, + fixtureValues.programId, + "Default", + "default", + "blue", + "reward_click_runtime_sql", + "reward_lead_runtime_sql", + null, + "discount_runtime_sql", + new Date("2024-01-04T03:30:00.000Z"), + new Date("2024-01-04T03:30:00.000Z"), + new Date("2024-01-04T03:30:00.000Z"), + ], + ); + await pool.query( + 'insert into "Partner" ("id", "name", "username", "companyName", "profileType", "email", "image", "description", "country", "payoutsEnabledAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)', + [ + fixtureValues.partnerId, + "Runtime SQL Partner", + "runtime-sql-partner", + null, + "individual", + "partner@example.com", + "https://example.com/partner.png", + "Partner used by runtime SQL comparisons", + "US", + new Date("2024-01-04T04:00:00.000Z"), + new Date("2024-01-04T04:00:00.000Z"), + new Date("2024-01-04T04:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "ProgramEnrollment" ("id", "partnerId", "programId", "tenantId", "groupId", "status", "totalClicks", "totalLeads", "totalConversions", "totalSales", "totalSaleAmount", "totalCommissions", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)', + [ + fixtureValues.programEnrollmentId, + fixtureValues.partnerId, + fixtureValues.programId, + "tenant_runtime_sql", + fixtureValues.partnerGroupId, + "approved", + 11, + 3, + 2, + 1, + "5000", + "1200", + new Date("2024-01-04T05:00:00.000Z"), + new Date("2024-01-04T05:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Invoice" ("id", "programId", "workspaceId", "number", "status", "type", "payoutMode", "paymentMethod", "amount", "fee", "total", "externalAmount", "createdAt", "paidAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)', + [ + fixtureValues.invoiceId, + fixtureValues.programId, + fixtureValues.programWorkspaceId, + "INV-RUNTIME-SQL", + "completed", + "partnerPayout", + "internal", + "card", + 1200, + 120, + 1320, + 0, + new Date("2024-01-12T00:00:00.000Z"), + new Date("2024-01-12T01:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Payout" ("id", "programId", "partnerId", "invoiceId", "amount", "currency", "status", "mode", "method", "description", "periodStart", "periodEnd", "createdAt", "updatedAt", "paidAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)', + [ + fixtureValues.payoutId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.invoiceId, + 1200, + "USD", + "processed", + "internal", + "paypal", + "Runtime SQL processed payout", + new Date("2024-01-01T00:00:00.000Z"), + new Date("2024-01-31T23:59:59.000Z"), + new Date("2024-01-12T02:00:00.000Z"), + new Date("2024-01-12T02:00:00.000Z"), + new Date("2024-01-12T03:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Payout" ("id", "programId", "partnerId", "invoiceId", "amount", "currency", "status", "mode", "method", "description", "periodStart", "periodEnd", "createdAt", "updatedAt", "paidAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)', + [ + fixtureValues.payoutPendingId, + fixtureValues.programId, + fixtureValues.partnerId, + null, + 500, + "USD", + "pending", + "internal", + "paypal", + "Runtime SQL pending payout", + new Date("2024-02-01T00:00:00.000Z"), + new Date("2024-02-29T23:59:59.000Z"), + new Date("2024-02-01T02:00:00.000Z"), + new Date("2024-02-01T02:00:00.000Z"), + null, + ], + ); + await pool.query( + 'insert into "Commission" ("id", "programId", "partnerId", "linkId", "payoutId", "invoiceId", "customerId", "eventId", "description", "type", "amount", "quantity", "earnings", "currency", "status", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)', + [ + fixtureValues.commissionId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.linkId, + fixtureValues.payoutPendingId, + "sale_event_runtime_sql", + fixtureValues.customerId, + "event_runtime_sql", + "Runtime SQL pending commission", + "sale", + 5000, + 1, + 500, + "usd", + "pending", + new Date("2024-01-13T00:00:00.000Z"), + new Date("2024-01-13T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Commission" ("id", "programId", "partnerId", "linkId", "payoutId", "invoiceId", "customerId", "eventId", "description", "type", "amount", "quantity", "earnings", "currency", "status", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)', + [ + fixtureValues.commissionProcessedId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.linkId, + fixtureValues.payoutId, + fixtureValues.invoiceId, + fixtureValues.customerId, + "event_processed_runtime_sql", + "Runtime SQL processed commission", + "sale", + 12000, + 1, + 1200, + "usd", + "processed", + new Date("2024-01-14T00:00:00.000Z"), + new Date("2024-01-14T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "ProgramApplication" ("id", "programId", "groupId", "name", "email", "country", "website", "formData", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)', + [ + fixtureValues.programApplicationId, + fixtureValues.programId, + fixtureValues.partnerGroupId, + "Runtime SQL Applicant", + "applicant@example.com", + "US", + "https://example.com/applicant", + JSON.stringify({ audience: "developers" }), + new Date("2024-01-17T00:00:00.000Z"), + new Date("2024-01-17T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "ProgramApplicationEvent" ("id", "programId", "visitedAt", "startedAt", "submittedAt", "approvedAt", "rejectedAt", "country", "referralSource", "referredByPartnerId", "metadata", "programApplicationId", "partnerId") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)', + [ + fixtureValues.programApplicationEventId, + fixtureValues.programId, + new Date("2024-01-17T01:00:00.000Z"), + new Date("2024-01-17T01:05:00.000Z"), + new Date("2024-01-17T01:10:00.000Z"), + null, + null, + "US", + "marketplace", + fixtureValues.partnerId, + JSON.stringify({ path: "/programs/runtime-sql-program" }), + fixtureValues.programApplicationId, + fixtureValues.partnerId, + ], + ); + await pool.query( + 'insert into "ProgramApplicationEvent" ("id", "programId", "visitedAt", "startedAt", "submittedAt", "approvedAt", "rejectedAt", "country", "referralSource", "referredByPartnerId", "metadata", "programApplicationId", "partnerId") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)', + [ + fixtureValues.programApplicationEventSecondId, + fixtureValues.programId, + new Date("2024-01-17T02:00:00.000Z"), + null, + null, + null, + new Date("2024-01-17T02:20:00.000Z"), + "CA", + "direct", + null, + JSON.stringify({ path: "/programs/runtime-sql-program?ref=direct" }), + null, + null, + ], + ); + await pool.query( + 'insert into "Workflow" ("id", "programId", "name", "trigger", "triggerConditions", "actions", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8)', + [ + fixtureValues.workflowId, + fixtureValues.programId, + "Runtime SQL Workflow", + "partnerMetricsUpdated", + JSON.stringify([{ field: "totalSales", operator: "gte", value: 10 }]), + JSON.stringify([{ type: "sendReward" }]), + new Date("2024-01-18T00:00:00.000Z"), + new Date("2024-01-18T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Bounty" ("id", "programId", "workflowId", "name", "description", "type", "startsAt", "endsAt", "submissionsOpenAt", "submissionFrequency", "maxSubmissions", "rewardAmount", "rewardDescription", "performanceScope", "submissionRequirements", "socialMetricsLastSyncedAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18)', + [ + fixtureValues.bountyId, + fixtureValues.programId, + fixtureValues.workflowId, + "Runtime SQL Bounty", + "Bounty used by runtime SQL comparisons", + "submission", + new Date("2024-01-18T01:00:00.000Z"), + new Date("2024-02-18T01:00:00.000Z"), + new Date("2024-01-18T01:30:00.000Z"), + "week", + 2, + 2500, + "Submit a runtime SQL proof", + "new", + JSON.stringify([{ type: "text", label: "Proof" }]), + new Date("2024-01-18T02:00:00.000Z"), + new Date("2024-01-18T01:00:00.000Z"), + new Date("2024-01-18T01:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "BountyGroup" ("id", "bountyId", "groupId") values ($1, $2, $3)', + [ + fixtureValues.bountyGroupId, + fixtureValues.bountyId, + fixtureValues.partnerGroupId, + ], + ); + await pool.query( + 'insert into "BountySubmission" ("id", "programId", "partnerId", "bountyId", "performanceCount", "socialMetricCount", "commissionId", "userId", "description", "status", "files", "urls", "periodNumber", "completedAt", "reviewedAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)', + [ + fixtureValues.bountySubmissionId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.bountyId, + "42", + 7, + null, + null, + "Runtime SQL submitted bounty proof", + "submitted", + JSON.stringify([{ name: "proof.png" }]), + JSON.stringify(["https://example.com/proof"]), + 1, + new Date("2024-01-18T03:00:00.000Z"), + null, + new Date("2024-01-18T03:00:00.000Z"), + new Date("2024-01-18T03:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "BountySubmission" ("id", "programId", "partnerId", "bountyId", "performanceCount", "socialMetricCount", "commissionId", "userId", "description", "status", "files", "urls", "periodNumber", "completedAt", "reviewedAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)', + [ + fixtureValues.bountySubmissionSecondId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.bountyId, + "84", + 11, + fixtureValues.commissionProcessedId, + fixtureValues.userId, + "Runtime SQL approved bounty proof", + "approved", + JSON.stringify([{ name: "approved.png" }]), + JSON.stringify(["https://example.com/approved"]), + 2, + new Date("2024-01-19T03:00:00.000Z"), + new Date("2024-01-19T04:00:00.000Z"), + new Date("2024-01-19T03:00:00.000Z"), + new Date("2024-01-19T04:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "NotificationEmail" ("id", "emailId", "type", "campaignId", "programId", "partnerId", "recipientUserId", "deliveredAt", "openedAt", "bouncedAt", "createdAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)', + [ + fixtureValues.notificationEmailId, + "notification-runtime-sql@example.com", + "Campaign", + fixtureValues.campaignId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.userId, + null, + null, + null, + new Date("2024-01-15T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "NotificationEmail" ("id", "emailId", "type", "campaignId", "programId", "partnerId", "recipientUserId", "deliveredAt", "openedAt", "bouncedAt", "createdAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)', + [ + fixtureValues.notificationEmailOpenedId, + "notification-opened-runtime-sql@example.com", + "Campaign", + fixtureValues.campaignId, + fixtureValues.programId, + fixtureValues.partnerId, + fixtureValues.userId, + new Date("2024-01-15T01:00:00.000Z"), + new Date("2024-01-15T02:00:00.000Z"), + new Date("2024-01-15T03:00:00.000Z"), + new Date("2024-01-15T00:30:00.000Z"), + ], + ); + await pool.query( + 'insert into "Postback" ("id", "partnerId", "name", "url", "secret", "triggers", "receiver", "disabledAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)', + [ + fixtureValues.postbackId, + fixtureValues.partnerId, + "Runtime SQL Postback", + "https://example.com/postback", + "postback_secret_runtime_sql", + JSON.stringify(["lead.created", "sale.created"]), + "custom", + null, + new Date("2024-01-16T00:00:00.000Z"), + new Date("2024-01-16T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Postback" ("id", "partnerId", "name", "url", "secret", "triggers", "receiver", "disabledAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)', + [ + fixtureValues.postbackDisabledId, + fixtureValues.partnerId, + "Runtime SQL Disabled Postback", + "https://example.com/postback-disabled", + "postback_disabled_secret_runtime_sql", + JSON.stringify(["lead.created"]), + "slack", + new Date("2024-01-16T01:00:00.000Z"), + new Date("2024-01-16T00:30:00.000Z"), + new Date("2024-01-16T01:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "ProjectUsers" ("id", "role", "userId", "projectId", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6)', + [ + "project_user_runtime_sql", + "owner", + fixtureValues.userId, + fixtureValues.projectId, + new Date("2024-01-03T01:00:00.000Z"), + new Date("2024-01-03T01:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Folder" ("id", "name", "description", "projectId", "type", "accessLevel", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8)', + [ + fixtureValues.folderId, + "Runtime SQL Folder", + "Folder used by runtime SQL comparisons", + fixtureValues.projectId, + "default", + "write", + new Date("2024-01-05T00:00:00.000Z"), + new Date("2024-01-05T01:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "FolderUser" ("id", "folderId", "userId", "role", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6)', + [ + "folder_user_runtime_sql", + fixtureValues.folderId, + fixtureValues.userId, + "owner", + new Date("2024-01-05T02:00:00.000Z"), + new Date("2024-01-05T02:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Link" ("id", "domain", "key", "url", "shortLink", "proxy", "title", "description", "image", "video", "rewrite", "password", "expiresAt", "ios", "android", "geo", "folderId", "projectId", "userId", "programId", "partnerId", "publicStats", "trackConversion", "clicks", "leads", "conversions", "sales", "saleAmount", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30)', + [ + fixtureValues.linkId, + "dub.sh", + "runtime-sql", + "https://example.com/runtime-sql", + "https://dub.sh/runtime-sql", + false, + "Runtime SQL Link", + "Link used by runtime SQL comparisons", + "https://example.com/link.png", + null, + false, + null, + null, + null, + null, + JSON.stringify({ US: "https://example.com/us" }), + fixtureValues.folderId, + fixtureValues.projectId, + fixtureValues.userId, + fixtureValues.programId, + fixtureValues.partnerId, + false, + true, + 5, + 2, + 1, + 1, + "5000", + new Date("2024-01-05T03:00:00.000Z"), + new Date("2024-01-05T03:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Customer" ("id", "name", "email", "externalId", "linkId", "country", "sales", "saleAmount", "projectId", "programId", "partnerId", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)', + [ + fixtureValues.customerId, + "Runtime SQL Customer", + "customer@example.com", + "external_runtime_sql", + fixtureValues.linkId, + "US", + 1, + "5000", + fixtureValues.projectId, + fixtureValues.programId, + fixtureValues.partnerId, + new Date("2024-01-11T00:00:00.000Z"), + new Date("2024-01-11T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "Integration" ("id", "userId", "projectId", "name", "slug", "developer", "website", "verified", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)', + [ + fixtureValues.integrationId, + fixtureValues.userId, + fixtureValues.projectId, + "Runtime SQL Integration", + "runtime-sql-integration", + "Dub", + "https://dub.co", + true, + new Date("2024-01-06T00:00:00.000Z"), + new Date("2024-01-06T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "InstalledIntegration" ("id", "userId", "integrationId", "projectId", "createdAt", "updatedAt", "credentials", "settings") values ($1, $2, $3, $4, $5, $6, $7, $8)', + [ + fixtureValues.installedIntegrationId, + fixtureValues.userId, + fixtureValues.integrationId, + fixtureValues.projectId, + new Date("2024-01-06T01:00:00.000Z"), + new Date("2024-01-06T01:00:00.000Z"), + JSON.stringify({ token: "runtime-sql" }), + JSON.stringify({ enabled: true }), + ], + ); + await pool.query( + 'insert into "Tag" ("id", "name", "color", "createdAt", "updatedAt", "projectId") values ($1, $2, $3, $4, $5, $6)', + [ + fixtureValues.tagId, + "Runtime SQL Tag", + "blue", + new Date("2024-01-07T00:00:00.000Z"), + new Date("2024-01-07T00:00:00.000Z"), + fixtureValues.projectId, + ], + ); + await pool.query( + 'insert into "RestrictedToken" ("id", "name", "hashedKey", "partialKey", "scopes", "lastUsed", "createdAt", "updatedAt", "userId", "projectId", "installationId") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)', + [ + fixtureValues.restrictedTokenId, + "Runtime SQL Token", + "hashed_runtime_sql", + "dub_1234", + "links.read domains.read", + new Date("2024-01-08T00:00:00.000Z"), + new Date("2024-01-08T00:00:00.000Z"), + new Date("2024-01-08T00:00:00.000Z"), + fixtureValues.userId, + fixtureValues.projectId, + null, + ], + ); + await pool.query( + 'insert into "Webhook" ("id", "projectId", "installationId", "receiver", "name", "url", "secret", "triggers", "disabledAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)', + [ + fixtureValues.webhookId, + fixtureValues.projectId, + null, + "user", + "Runtime SQL Webhook", + "https://example.com/webhook", + "secret_runtime_sql", + JSON.stringify(["link.created", "link.updated"]), + null, + new Date("2024-01-09T00:00:00.000Z"), + new Date("2024-01-09T00:00:00.000Z"), + ], + ); + await pool.query( + 'insert into "LinkWebhook" ("id", "linkId", "webhookId") values ($1, $2, $3)', + ["link_webhook_runtime_sql", fixtureValues.linkId, fixtureValues.webhookId], + ); + await pool.query( + 'insert into "Domain" ("id", "slug", "verified", "placeholder", "expiredUrl", "notFoundUrl", "primary", "archived", "lastChecked", "logo", "appleAppSiteAssociation", "assetLinks", "deepviewData", "linkRetentionDays", "createdAt", "updatedAt", "projectId") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)', + [ + fixtureValues.domainId, + "runtime-sql.example.com", + true, + "https://example.com", + null, + null, + true, + false, + new Date("2024-01-10T00:00:00.000Z"), + null, + JSON.stringify({ applinks: { apps: [] } }), + JSON.stringify([ + { relation: ["delegate_permission/common.handle_all_urls"] }, + ]), + JSON.stringify({}), + 30, + new Date("2024-01-10T00:00:00.000Z"), + new Date("2024-01-10T00:00:00.000Z"), + fixtureValues.projectId, + ], + ); + await pool.query( + 'insert into "RegisteredDomain" ("id", "slug", "projectId", "domainId", "autoRenewalDisabledAt", "renewalFee", "expiresAt", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9)', + [ + "registered_domain_runtime_sql", + "runtime-sql.example.com", + fixtureValues.projectId, + fixtureValues.domainId, + null, + 1200, + new Date("2025-01-10T00:00:00.000Z"), + new Date("2024-01-10T00:00:00.000Z"), + new Date("2024-01-10T00:00:00.000Z"), + ], + ); + + if (includeDashboard) { + await pool.query( + 'insert into "Dashboard" ("id", "linkId", "projectId", "userId", "password", "showConversions", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8)', + [ + dashboardIds.existing, + fixtureValues.linkId, + fixtureValues.projectId, + fixtureValues.userId, + "old-password", + false, + new Date("2024-01-01T00:00:00.000Z"), + new Date("2024-01-02T03:04:05.000Z"), + ], + ); + } +} + +async function snapshotRuntimeFixture(pool) { + const [ + users, + projects, + projectUsers, + integrations, + installedIntegrations, + tags, + restrictedTokens, + webhooks, + linkWebhooks, + domains, + registeredDomains, + programs, + programCategories, + partnerGroups, + partners, + programEnrollments, + invoices, + payouts, + commissions, + programApplications, + programApplicationEvents, + workflows, + bounties, + bountyGroups, + bountySubmissions, + notificationEmails, + postbacks, + customers, + folders, + folderUsers, + links, + dashboards, + ] = await Promise.all([ + pool.query('select * from "User" order by "id"'), + pool.query('select * from "Project" order by "id"'), + pool.query('select * from "ProjectUsers" order by "id"'), + pool.query('select * from "Integration" order by "id"'), + pool.query('select * from "InstalledIntegration" order by "id"'), + pool.query('select * from "Tag" order by "id"'), + pool.query('select * from "RestrictedToken" order by "id"'), + pool.query('select * from "Webhook" order by "id"'), + pool.query('select * from "LinkWebhook" order by "id"'), + pool.query('select * from "Domain" order by "id"'), + pool.query('select * from "RegisteredDomain" order by "id"'), + pool.query('select * from "Program" order by "id"'), + pool.query('select * from "ProgramCategory" order by "programId", "category"'), + pool.query('select * from "PartnerGroup" order by "id"'), + pool.query('select * from "Partner" order by "id"'), + pool.query('select * from "ProgramEnrollment" order by "id"'), + pool.query('select * from "Invoice" order by "id"'), + pool.query('select * from "Payout" order by "id"'), + pool.query('select * from "Commission" order by "id"'), + pool.query('select * from "ProgramApplication" order by "id"'), + pool.query('select * from "ProgramApplicationEvent" order by "id"'), + pool.query('select * from "Workflow" order by "id"'), + pool.query('select * from "Bounty" order by "id"'), + pool.query('select * from "BountyGroup" order by "id"'), + pool.query('select * from "BountySubmission" order by "id"'), + pool.query('select * from "NotificationEmail" order by "id"'), + pool.query('select * from "Postback" order by "id"'), + pool.query('select * from "Customer" order by "id"'), + pool.query('select * from "Folder" order by "id"'), + pool.query('select * from "FolderUser" order by "id"'), + pool.query('select * from "Link" order by "id"'), + pool.query('select * from "Dashboard" order by "id"'), + ]); + + return { + User: users.rows, + Project: projects.rows, + ProjectUsers: projectUsers.rows, + Integration: integrations.rows, + InstalledIntegration: installedIntegrations.rows, + Tag: tags.rows, + RestrictedToken: restrictedTokens.rows, + Webhook: webhooks.rows, + LinkWebhook: linkWebhooks.rows, + Domain: domains.rows, + RegisteredDomain: registeredDomains.rows, + Program: programs.rows, + ProgramCategory: programCategories.rows, + PartnerGroup: partnerGroups.rows, + Partner: partners.rows, + ProgramEnrollment: programEnrollments.rows, + Invoice: invoices.rows, + Payout: payouts.rows, + Commission: commissions.rows, + ProgramApplication: programApplications.rows, + ProgramApplicationEvent: programApplicationEvents.rows, + Workflow: workflows.rows, + Bounty: bounties.rows, + BountyGroup: bountyGroups.rows, + BountySubmission: bountySubmissions.rows, + NotificationEmail: notificationEmails.rows, + Postback: postbacks.rows, + Customer: customers.rows, + Folder: folders.rows, + FolderUser: folderUsers.rows, + Link: links.rows, + Dashboard: dashboards.rows, + }; +} + +function compareSnapshots(prisma6Snapshot, prismaNextSnapshot) { + const prisma6Summary = summarizeResult(prisma6Snapshot); + const prismaNextSummary = summarizeResult(prismaNextSnapshot); + const prisma6TypeShape = typeShape(prisma6Summary); + const prismaNextTypeShape = typeShape(prismaNextSummary); + + return { + prisma6Hash: stableHash(prisma6Snapshot), + prismaNextHash: stableHash(prismaNextSnapshot), + valueEqual: stableJson(prisma6Snapshot) === stableJson(prismaNextSnapshot), + typeShapeEqual: + stableJson(prisma6TypeShape) === stableJson(prismaNextTypeShape), + prisma6Summary, + prismaNextSummary, + prisma6TypeShape, + prismaNextTypeShape, + }; +} + +function createPrisma6Client(databaseUrl, collector) { + const pool = new CapturingPool({ connectionString: databaseUrl }, collector); + const client = new PrismaClient({ + adapter: new PrismaPg(pool), + log: [{ emit: "event", level: "query" }], + omit: { + user: { passwordHash: true }, + }, + }); + client.$on("query", (event) => collector.recordQueryEvent(event)); + return { client, pool }; +} + +function createPrismaNextClient(databaseUrl, collector) { + const middleware = { + name: "dub-runtime-sql-collector", + familyId: "sql", + targetId: "postgres", + beforeExecute(exec) { + collector.record({ + sql: exec.sql, + params: exec.params ?? [], + meta: exec.meta, + }); + }, + }; + + return postgres({ + contractJson, + url: databaseUrl, + verify: { mode: "onFirstUse", requireMarker: false }, + middleware: [middleware], + }); +} + +const dashboardModule = { + id: "dashboard-runtime-module", + description: + "First module-sized comparison for Dashboard read/write operations used by dashboard routes.", + operations: [ + { + id: "dashboard.read.selected-relations", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: true }), + prisma6: ({ prisma }) => + prisma.dashboard.findUnique({ + where: { id: dashboardIds.existing }, + select: { + id: true, + doIndex: true, + password: true, + showConversions: true, + link: { + select: { + id: true, + domain: true, + key: true, + url: true, + }, + }, + folder: { + select: { + id: true, + name: true, + }, + }, + project: { + select: { + plan: true, + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.Dashboard.where({ id: dashboardIds.existing }) + .select("id", "doIndex", "password", "showConversions") + .include("link", (link) => link.select("id", "domain", "key", "url")) + .include("folder", (folder) => folder.select("id", "name")) + .include("project", (project) => project.select("plan")) + .first(), + }, + { + id: "dashboard.create.link-dashboard", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.dashboard.create({ + data: { + id: dashboardIds.create, + linkId: fixtureValues.linkId, + projectId: fixtureValues.projectId, + userId: fixtureValues.userId, + showConversions: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Dashboard.create({ + id: dashboardIds.create, + linkId: fixtureValues.linkId, + projectId: fixtureValues.projectId, + userId: fixtureValues.userId, + showConversions: true, + }), + }, + { + id: "dashboard.update.password", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: true }), + prisma6: ({ prisma }) => + prisma.dashboard.update({ + where: { id: dashboardIds.existing }, + data: { password: "new-password" }, + }), + prismaNext: ({ db }) => + db.orm.Dashboard.where({ id: dashboardIds.existing }).update({ + password: "new-password", + }), + }, + { + id: "dashboard.update.explicit-updated-at", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: true }), + prisma6: ({ prisma }) => + prisma.dashboard.update({ + where: { id: dashboardIds.existing }, + data: { + password: "explicit-date-password", + updatedAt: new Date("2001-02-03T04:05:06.000Z"), + }, + }), + prismaNext: ({ db }) => + db.orm.Dashboard.where({ id: dashboardIds.existing }).update({ + password: "explicit-date-password", + updatedAt: new Date("2001-02-03T04:05:06.000Z"), + }), + }, + { + id: "dashboard.delete", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: true }), + prisma6: ({ prisma }) => + prisma.dashboard.delete({ + where: { + id: dashboardIds.existing, + projectId: fixtureValues.projectId, + }, + }), + prismaNext: ({ db }) => + db.orm.Dashboard.where({ + id: dashboardIds.existing, + projectId: fixtureValues.projectId, + }).delete(), + }, + ], +}; + +const userModule = { + id: "user-runtime-module", + description: + "Module-sized comparison for user existence lookups, representative of request/auth helper reads.", + operations: [ + { + id: "user.read.exists-by-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => + Boolean( + await prisma.user.findUnique({ + where: { id: fixtureValues.userId }, + select: { id: true }, + }), + ), + prismaNext: async ({ db }) => + Boolean( + await db.orm.User.where({ id: fixtureValues.userId }) + .select("id") + .first(), + ), + }, + { + id: "user.read.missing-by-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => + Boolean( + await prisma.user.findUnique({ + where: { id: "missing_runtime_sql_user" }, + select: { id: true }, + }), + ), + prismaNext: async ({ db }) => + Boolean( + await db.orm.User.where({ id: "missing_runtime_sql_user" }) + .select("id") + .first(), + ), + }, + ], +}; + +const linkModule = { + id: "link-runtime-module", + description: + "Module-sized comparison for short-link existence lookups by domain/key compound identity.", + operations: [ + { + id: "link.read.exists-by-domain-key", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => + Boolean( + await prisma.link.findUnique({ + where: { + domain_key: { + domain: "dub.sh", + key: "runtime-sql", + }, + }, + select: { id: true }, + }), + ), + prismaNext: async ({ db }) => + Boolean( + await db.orm.Link.where({ + domain: "dub.sh", + key: "runtime-sql", + }) + .select("id") + .first(), + ), + }, + { + id: "link.read.missing-by-domain-key", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => + Boolean( + await prisma.link.findUnique({ + where: { + domain_key: { + domain: "dub.sh", + key: "missing-runtime-sql", + }, + }, + select: { id: true }, + }), + ), + prismaNext: async ({ db }) => + Boolean( + await db.orm.Link.where({ + domain: "dub.sh", + key: "missing-runtime-sql", + }) + .select("id") + .first(), + ), + }, + ], +}; + +const edgeLinkModule = { + id: "edge-link-runtime-module", + description: + "Module-sized comparison for edge link reads currently backed by direct Postgres queries.", + operations: [ + { + id: "edge-link.read.by-shortlink", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.link.findUnique({ + where: { + shortLink: "https://dub.sh/runtime-sql", + }, + select: selectFields(edgeLinkScalarFields), + }), + prismaNext: ({ db }) => + db.orm.Link.where({ + shortLink: "https://dub.sh/runtime-sql", + }) + .select(...edgeLinkScalarFields) + .first(), + }, + { + id: "edge-link.read.by-domain-key-with-webhooks", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.link.findUnique({ + where: { + domain_key: { + domain: "dub.sh", + key: "runtime-sql", + }, + }, + select: { + ...selectFields(edgeLinkScalarFields), + webhooks: { + select: { + webhookId: true, + }, + orderBy: { + webhookId: "asc", + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.Link.where({ + domain: "dub.sh", + key: "runtime-sql", + }) + .select(...edgeLinkScalarFields) + .include("webhooks", (webhooks) => + webhooks + .select("webhookId") + .orderBy((webhook) => webhook.webhookId.asc()), + ) + .first(), + }, + ], +}; + +const analyticsModule = { + id: "analytics-runtime-module", + description: + "Module-sized comparison for the all-time link analytics aggregate shortcut.", + operations: [ + { + id: "analytics.read.all-time-clicks-for-link", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const result = await prisma.link.aggregate({ + where: { + id: { + in: [fixtureValues.linkId], + }, + }, + _sum: { + clicks: true, + }, + }); + return { + clicks: result._sum.clicks ?? 0, + }; + }, + prismaNext: ({ db }) => + db.orm.Link.where((link) => + link.id.in([fixtureValues.linkId]), + ).aggregate((aggregate) => ({ + clicks: aggregate.sum("clicks"), + })), + }, + { + id: "analytics.read.all-time-composite-for-link", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const result = await prisma.link.aggregate({ + where: { + id: { + in: [fixtureValues.linkId], + }, + }, + _sum: { + clicks: true, + leads: true, + sales: true, + saleAmount: true, + }, + }); + return { + clicks: result._sum.clicks ?? 0, + leads: result._sum.leads ?? 0, + sales: result._sum.sales ?? 0, + saleAmount: result._sum.saleAmount ?? 0n, + }; + }, + prismaNext: ({ db }) => + db.orm.Link.where((link) => + link.id.in([fixtureValues.linkId]), + ).aggregate((aggregate) => ({ + clicks: aggregate.sum("clicks"), + leads: aggregate.sum("leads"), + sales: aggregate.sum("sales"), + saleAmount: aggregate.sum("saleAmount"), + })), + }, + ], +}; + +const commissionsPayoutsModule = { + id: "commissions-payouts-runtime-module", + description: + "Module-sized comparison for commissions and payouts reads, aggregates, grouped aggregates, and write counts.", + operations: [ + { + id: "commissions.read.program-active-commissions", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.commission.findMany({ + where: { + programId: fixtureValues.programId, + status: { + in: ["pending", "processed"], + }, + }, + select: { + id: true, + programId: true, + partnerId: true, + payoutId: true, + amount: true, + earnings: true, + status: true, + createdAt: true, + }, + orderBy: { + createdAt: "asc", + }, + }), + prismaNext: ({ db }) => + db.orm.Commission.where((commission) => + and( + commission.programId.eq(fixtureValues.programId), + commission.status.in(["pending", "processed"]), + ), + ) + .select( + "id", + "programId", + "partnerId", + "payoutId", + "amount", + "earnings", + "status", + "createdAt", + ) + .orderBy((commission) => commission.createdAt.asc()) + .all(), + }, + { + id: "commissions.aggregate.earnings-by-payout", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const rows = await prisma.commission.groupBy({ + by: ["payoutId"], + where: { + payoutId: { + not: null, + }, + }, + _sum: { + earnings: true, + }, + orderBy: { + payoutId: "asc", + }, + }); + return rows.map((row) => ({ + payoutId: row.payoutId, + earnings: row._sum.earnings, + })); + }, + prismaNext: async ({ db }) => { + const rows = await db.orm.Commission.where((commission) => + commission.payoutId.isNotNull(), + ) + .groupBy("payoutId") + .aggregate((aggregate) => ({ + earnings: aggregate.sum("earnings"), + })); + return rows + .map((row) => ({ + payoutId: row.payoutId, + earnings: row.earnings, + })) + .sort((left, right) => left.payoutId.localeCompare(right.payoutId)); + }, + }, + { + id: "commissions.update.mark-paid-count", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.commission.updateMany({ + where: { + id: { + in: [fixtureValues.commissionId], + }, + }, + data: { + payoutId: null, + status: "paid", + }, + }), + prismaNext: async ({ db }) => ({ + count: await db.orm.Commission.where((commission) => + commission.id.in([fixtureValues.commissionId]), + ).updateCount({ + payoutId: null, + status: "paid", + }), + }), + }, + { + id: "payouts.aggregate.processed-with-enabled-partner", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const totals = await prisma.payout.aggregate({ + where: { + status: "processed", + amount: { + gte: 1000, + }, + partner: { + payoutsEnabledAt: { + not: null, + }, + }, + }, + _count: { + id: true, + }, + _sum: { + amount: true, + }, + }); + return { + count: totals._count.id, + amount: totals._sum.amount ?? 0, + }; + }, + prismaNext: ({ db }) => + db.orm.Payout.where((payout) => + and( + payout.status.eq("processed"), + payout.amount.gte(1000), + payout.partner.some((partner) => + partner.payoutsEnabledAt.isNotNull(), + ), + ), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + amount: aggregate.sum("amount"), + })), + }, + { + id: "payouts.read.processed-with-partner-email", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.payout.findMany({ + where: { + status: "processed", + amount: { + gte: 1000, + }, + partner: { + payoutsEnabledAt: { + not: null, + }, + }, + }, + select: { + id: true, + amount: true, + paidAt: true, + partner: { + select: { + email: true, + }, + }, + }, + take: 100, + orderBy: { + paidAt: "asc", + }, + }), + prismaNext: ({ db }) => + db.orm.Payout.where((payout) => + and( + payout.status.eq("processed"), + payout.amount.gte(1000), + payout.partner.some((partner) => + partner.payoutsEnabledAt.isNotNull(), + ), + ), + ) + .select("id", "amount", "paidAt") + .include("partner", (partner) => partner.select("email")) + .take(100) + .orderBy((payout) => payout.paidAt.asc()) + .all(), + }, + { + id: "payouts.update.pending-amount", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.payout.update({ + where: { + id: fixtureValues.payoutPendingId, + }, + data: { + amount: 700, + }, + select: { + id: true, + amount: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Payout.where({ id: fixtureValues.payoutPendingId }) + .select("id", "amount", "updatedAt") + .update({ + amount: 700, + }), + }, + ], +}; + +const notificationEmailModule = { + id: "notification-email-runtime-module", + description: + "Module-sized comparison for notification email webhook reads/writes and campaign summary aggregation.", + operations: [ + { + id: "notification-email.read.by-email-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.notificationEmail.findUnique({ + where: { + emailId: "notification-runtime-sql@example.com", + }, + select: { + id: true, + emailId: true, + type: true, + deliveredAt: true, + openedAt: true, + bouncedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.NotificationEmail.where({ + emailId: "notification-runtime-sql@example.com", + }) + .select( + "id", + "emailId", + "type", + "deliveredAt", + "openedAt", + "bouncedAt", + ) + .first(), + }, + { + id: "notification-email.update.delivered-at", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.notificationEmail.update({ + where: { + emailId: "notification-runtime-sql@example.com", + }, + data: { + deliveredAt: new Date("2024-01-15T04:00:00.000Z"), + }, + select: { + id: true, + emailId: true, + deliveredAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.NotificationEmail.where({ + emailId: "notification-runtime-sql@example.com", + }) + .select("id", "emailId", "deliveredAt") + .update({ + deliveredAt: new Date("2024-01-15T04:00:00.000Z"), + }), + }, + { + id: "notification-email.aggregate.campaign-summary", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const [queryResult] = await prisma.$queryRaw` + SELECT + COUNT(*) AS sent, + SUM(CASE WHEN "deliveredAt" IS NOT NULL THEN 1 ELSE 0 END) AS delivered, + SUM(CASE WHEN "openedAt" IS NOT NULL THEN 1 ELSE 0 END) AS opened, + SUM(CASE WHEN "bouncedAt" IS NOT NULL THEN 1 ELSE 0 END) AS bounced + FROM "NotificationEmail" + WHERE "campaignId" = ${fixtureValues.campaignId} + `; + + return { + sent: Number(queryResult.sent), + delivered: Number(queryResult.delivered), + opened: Number(queryResult.opened), + bounced: Number(queryResult.bounced), + }; + }, + prismaNext: async ({ db }) => { + const sent = await db.orm.NotificationEmail.where({ + campaignId: fixtureValues.campaignId, + }).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const delivered = await db.orm.NotificationEmail.where( + (notificationEmail) => + and( + notificationEmail.campaignId.eq(fixtureValues.campaignId), + notificationEmail.deliveredAt.isNotNull(), + ), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const opened = await db.orm.NotificationEmail.where( + (notificationEmail) => + and( + notificationEmail.campaignId.eq(fixtureValues.campaignId), + notificationEmail.openedAt.isNotNull(), + ), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const bounced = await db.orm.NotificationEmail.where( + (notificationEmail) => + and( + notificationEmail.campaignId.eq(fixtureValues.campaignId), + notificationEmail.bouncedAt.isNotNull(), + ), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + + return { + sent: sent.count, + delivered: delivered.count, + opened: opened.count, + bounced: bounced.count, + }; + }, + }, + ], +}; + +const postbackModule = { + id: "postback-runtime-module", + description: + "Module-sized comparison for partner postback lookup, JSON trigger filtering, and disable writes.", + operations: [ + { + id: "postback.read.by-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.postback.findUnique({ + where: { + id: fixtureValues.postbackId, + }, + select: { + id: true, + partnerId: true, + name: true, + url: true, + receiver: true, + triggers: true, + disabledAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Postback.where({ id: fixtureValues.postbackId }) + .select( + "id", + "partnerId", + "name", + "url", + "receiver", + "triggers", + "disabledAt", + ) + .first(), + }, + { + id: "postback.read.enabled-for-trigger", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.postback.findMany({ + where: { + partnerId: fixtureValues.partnerId, + disabledAt: null, + triggers: { + array_contains: ["lead.created"], + }, + }, + select: { + id: true, + partnerId: true, + receiver: true, + triggers: true, + disabledAt: true, + }, + orderBy: { + createdAt: "asc", + }, + }), + prismaNext: async ({ db }) => { + const rows = await db.orm.Postback.where((postback) => + and( + postback.partnerId.eq(fixtureValues.partnerId), + postback.disabledAt.isNull(), + ), + ) + .select("id", "partnerId", "receiver", "triggers", "disabledAt") + .orderBy((postback) => postback.createdAt.asc()) + .all() + .toArray(); + + return rows.filter( + (row) => + Array.isArray(row.triggers) && + row.triggers.includes("lead.created"), + ); + }, + }, + { + id: "postback.update.disable", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.postback.update({ + where: { + id: fixtureValues.postbackId, + }, + data: { + disabledAt: new Date("2024-01-16T02:00:00.000Z"), + }, + select: { + id: true, + disabledAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Postback.where({ id: fixtureValues.postbackId }) + .select("id", "disabledAt") + .update({ + disabledAt: new Date("2024-01-16T02:00:00.000Z"), + }), + }, + ], +}; + +const usageCounterModule = { + id: "usage-counter-runtime-module", + description: + "Module-sized comparison for click/link usage counter updates currently backed by direct Postgres writes.", + operations: [ + { + id: "usage.read.workspace-webhook-limit", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.findUnique({ + where: { + id: fixtureValues.projectId, + }, + select: { + usage: true, + usageLimit: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select("usage", "usageLimit") + .first(), + }, + { + id: "usage.update.link-click-increment", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.link.update({ + where: { + id: fixtureValues.linkId, + }, + data: { + clicks: { + increment: 1, + }, + lastClicked: new Date("2024-02-01T00:00:00.000Z"), + }, + select: { + id: true, + clicks: true, + lastClicked: true, + updatedAt: true, + }, + }), + prismaNext: async ({ db }) => { + const link = await db.orm.Link.where({ + id: fixtureValues.linkId, + }) + .select("clicks") + .first(); + return db.orm.Link.where({ + id: fixtureValues.linkId, + }) + .select("id", "clicks", "lastClicked", "updatedAt") + .update({ + clicks: (link?.clicks ?? 0) + 1, + lastClicked: new Date("2024-02-01T00:00:00.000Z"), + }); + }, + }, + { + id: "usage.update.workspace-clicks-increment", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.update({ + where: { + id: fixtureValues.projectId, + }, + data: { + usage: { + increment: 3, + }, + totalClicks: { + increment: 3, + }, + }, + select: { + id: true, + usage: true, + totalClicks: true, + updatedAt: true, + }, + }), + prismaNext: async ({ db }) => { + const workspace = await db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select("usage", "totalClicks") + .first(); + return db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select("id", "usage", "totalClicks", "updatedAt") + .update({ + usage: (workspace?.usage ?? 0) + 3, + totalClicks: (workspace?.totalClicks ?? 0) + 3, + }); + }, + }, + { + id: "usage.update.workspace-links-increment", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.update({ + where: { + id: fixtureValues.projectId, + }, + data: { + linksUsage: { + increment: 2, + }, + totalLinks: { + increment: 2, + }, + }, + select: { + id: true, + linksUsage: true, + totalLinks: true, + updatedAt: true, + }, + }), + prismaNext: async ({ db }) => { + const workspace = await db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select("linksUsage", "totalLinks") + .first(); + return db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select("id", "linksUsage", "totalLinks", "updatedAt") + .update({ + linksUsage: (workspace?.linksUsage ?? 0) + 2, + totalLinks: (workspace?.totalLinks ?? 0) + 2, + }); + }, + }, + { + id: "usage.update.program-enrollment-clicks-increment", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.programEnrollment.update({ + where: { + partnerId_programId: { + partnerId: fixtureValues.partnerId, + programId: fixtureValues.programId, + }, + }, + data: { + totalClicks: { + increment: 1, + }, + }, + select: { + id: true, + totalClicks: true, + updatedAt: true, + }, + }), + prismaNext: async ({ db }) => { + const enrollment = await db.orm.ProgramEnrollment.where({ + partnerId: fixtureValues.partnerId, + programId: fixtureValues.programId, + }) + .select("totalClicks") + .first(); + return db.orm.ProgramEnrollment.where({ + partnerId: fixtureValues.partnerId, + programId: fixtureValues.programId, + }) + .select("id", "totalClicks", "updatedAt") + .update({ + totalClicks: (enrollment?.totalClicks ?? 0) + 1, + }); + }, + }, + ], +}; + +const workspaceProductModule = { + id: "workspace-product-runtime-module", + description: + "Module-sized comparison for resolving workspace product mode from Project.defaultProgramId.", + operations: [ + { + id: "workspace-product.read.links-workspace", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const workspace = await prisma.project.findUnique({ + where: { slug: fixtureValues.projectSlug }, + select: { defaultProgramId: true }, + }); + return workspace?.defaultProgramId ? "program" : "links"; + }, + prismaNext: async ({ db }) => { + const workspace = await db.orm.Project.where({ + slug: fixtureValues.projectSlug, + }) + .select("defaultProgramId") + .first(); + return workspace?.defaultProgramId ? "program" : "links"; + }, + }, + { + id: "workspace-product.read.program-workspace", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const workspace = await prisma.project.findUnique({ + where: { slug: fixtureValues.programWorkspaceSlug }, + select: { defaultProgramId: true }, + }); + return workspace?.defaultProgramId ? "program" : "links"; + }, + prismaNext: async ({ db }) => { + const workspace = await db.orm.Project.where({ + slug: fixtureValues.programWorkspaceSlug, + }) + .select("defaultProgramId") + .first(); + return workspace?.defaultProgramId ? "program" : "links"; + }, + }, + ], +}; + +const workspaceModule = { + id: "workspace-runtime-module", + description: + "Module-sized comparison for common workspace fetchers that include membership metadata.", + operations: [ + { + id: "workspace.read.default-for-user", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.findFirst({ + where: { + users: { + some: { + userId: fixtureValues.userId, + }, + }, + }, + select: { + slug: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Project.where((project) => + project.users.some({ userId: fixtureValues.userId }), + ) + .select("slug") + .first(), + }, + { + id: "workspace.read.by-slug-with-user-role", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.findUnique({ + where: { + slug: fixtureValues.projectSlug, + }, + select: { + id: true, + name: true, + slug: true, + logo: true, + usage: true, + usageLimit: true, + plan: true, + stripeId: true, + billingCycleStart: true, + createdAt: true, + users: { + where: { + userId: fixtureValues.userId, + }, + select: { + role: true, + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.Project.where({ + slug: fixtureValues.projectSlug, + }) + .select( + "id", + "name", + "slug", + "logo", + "usage", + "usageLimit", + "plan", + "stripeId", + "billingCycleStart", + "createdAt", + ) + .include("users", (users) => + users.where({ userId: fixtureValues.userId }).select("role"), + ) + .first(), + }, + ], +}; + +const edgeWorkspaceModule = { + id: "edge-workspace-runtime-module", + description: + "Module-sized comparison for edge workspace reads currently backed by direct Postgres queries.", + operations: [ + { + id: "edge-workspace.read.by-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.findUnique({ + where: { + id: fixtureValues.projectId, + }, + select: selectFields(edgeWorkspaceScalarFields), + }), + prismaNext: ({ db }) => + db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select(...edgeWorkspaceScalarFields) + .first(), + }, + { + id: "edge-workspace.read.by-id-with-domains", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.project.findUnique({ + where: { + id: fixtureValues.projectId, + }, + select: { + ...selectFields(edgeWorkspaceScalarFields), + domains: { + select: { + slug: true, + }, + orderBy: { + slug: "asc", + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.Project.where({ + id: fixtureValues.projectId, + }) + .select(...edgeWorkspaceScalarFields) + .include("domains", (domains) => + domains.select("slug").orderBy((domain) => domain.slug.asc()), + ) + .first(), + }, + ], +}; + +const normalizeFolderAccessResult = (folder, workspaceId) => { + if (!folder || folder.projectId !== workspaceId) { + return null; + } + + return { + id: folder.id, + name: folder.name, + description: folder.description, + type: folder.type, + accessLevel: folder.accessLevel, + createdAt: folder.createdAt, + updatedAt: folder.updatedAt, + user: folder.users.length > 0 ? folder.users[0] : null, + }; +}; + +const folderModule = { + id: "folder-runtime-module", + description: + "Module-sized comparison for folder access lookups with filtered FolderUser includes.", + operations: [ + { + id: "folder.read.by-id-with-user", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const folder = await prisma.folder.findUnique({ + where: { + id: fixtureValues.folderId, + }, + select: { + id: true, + name: true, + description: true, + type: true, + accessLevel: true, + createdAt: true, + updatedAt: true, + projectId: true, + users: { + where: { + userId: fixtureValues.userId, + }, + take: 1, + }, + }, + }); + return normalizeFolderAccessResult(folder, fixtureValues.projectId); + }, + prismaNext: async ({ db }) => { + const folder = await db.orm.Folder.where({ + id: fixtureValues.folderId, + }) + .select( + "id", + "name", + "description", + "type", + "accessLevel", + "createdAt", + "updatedAt", + "projectId", + ) + .include("users", (users) => + users.where({ userId: fixtureValues.userId }).take(1), + ) + .first(); + return normalizeFolderAccessResult(folder, fixtureValues.projectId); + }, + }, + { + id: "folder.read.missing-by-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const folder = await prisma.folder.findUnique({ + where: { + id: "missing_runtime_sql_folder", + }, + select: { + id: true, + name: true, + description: true, + type: true, + accessLevel: true, + createdAt: true, + updatedAt: true, + projectId: true, + users: { + where: { + userId: fixtureValues.userId, + }, + take: 1, + }, + }, + }); + return normalizeFolderAccessResult(folder, fixtureValues.projectId); + }, + prismaNext: async ({ db }) => { + const folder = await db.orm.Folder.where({ + id: "missing_runtime_sql_folder", + }) + .select( + "id", + "name", + "description", + "type", + "accessLevel", + "createdAt", + "updatedAt", + "projectId", + ) + .include("users", (users) => + users.where({ userId: fixtureValues.userId }).take(1), + ) + .first(); + return normalizeFolderAccessResult(folder, fixtureValues.projectId); + }, + }, + ], +}; + +const integrationModule = { + id: "integration-runtime-module", + description: + "Module-sized comparison for verified integrations installed in a workspace.", + operations: [ + { + id: "integration.read.verified-installed-for-workspace", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.integration.findMany({ + select: { + id: true, + name: true, + slug: true, + }, + where: { + verified: true, + installations: { + some: { + projectId: fixtureValues.projectId, + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.Integration.where({ verified: true }) + .where((integration) => + integration.installations.some({ + projectId: fixtureValues.projectId, + }), + ) + .select("id", "name", "slug") + .all(), + }, + ], +}; + +const tagModule = { + id: "tag-runtime-module", + description: "Module-sized comparison for tag list and search reads.", + operations: [ + { + id: "tag.read.list-for-workspace", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.tag.findMany({ + where: { + projectId: fixtureValues.projectId, + }, + select: { + id: true, + name: true, + color: true, + }, + orderBy: { + name: "asc", + }, + take: 100, + skip: 0, + }), + prismaNext: ({ db }) => + db.orm.Tag.where({ projectId: fixtureValues.projectId }) + .select("id", "name", "color") + .orderBy((tag) => tag.name.asc()) + .take(100) + .skip(0) + .all(), + }, + { + id: "tag.read.search-for-workspace", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.tag.findMany({ + where: { + projectId: fixtureValues.projectId, + name: { + contains: "Runtime", + }, + }, + select: { + id: true, + name: true, + color: true, + }, + orderBy: { + name: "asc", + }, + take: 100, + skip: 0, + }), + prismaNext: ({ db }) => + db.orm.Tag.where({ projectId: fixtureValues.projectId }) + .where((tag) => tag.name.like("%Runtime%")) + .select("id", "name", "color") + .orderBy((tag) => tag.name.asc()) + .take(100) + .skip(0) + .all(), + }, + { + id: "tag.create.for-workspace", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.tag.create({ + data: { + id: fixtureValues.tagCreateId, + name: "Created Runtime SQL Tag", + color: "red", + projectId: fixtureValues.projectId, + }, + select: { + id: true, + name: true, + color: true, + projectId: true, + createdAt: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Tag.create({ + id: fixtureValues.tagCreateId, + name: "Created Runtime SQL Tag", + color: "red", + projectId: fixtureValues.projectId, + }), + }, + { + id: "tag.update.name", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.tag.update({ + where: { + id: fixtureValues.tagId, + }, + data: { + name: "Updated Runtime SQL Tag", + }, + select: { + id: true, + name: true, + color: true, + projectId: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Tag.where({ id: fixtureValues.tagId }) + .select("id", "name", "color", "projectId", "updatedAt") + .update({ + name: "Updated Runtime SQL Tag", + }), + }, + { + id: "tag.delete.by-id", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.tag.delete({ + where: { + id: fixtureValues.tagId, + }, + select: { + id: true, + name: true, + color: true, + projectId: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Tag.where({ id: fixtureValues.tagId }) + .select("id", "name", "color", "projectId") + .delete(), + }, + ], +}; + +const tokenModule = { + id: "token-runtime-module", + description: + "Module-sized comparison for restricted token listing with user includes.", + operations: [ + { + id: "token.read.workspace-restricted-tokens", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.restrictedToken.findMany({ + where: { + projectId: fixtureValues.projectId, + installationId: null, + }, + select: { + id: true, + name: true, + partialKey: true, + scopes: true, + lastUsed: true, + createdAt: true, + updatedAt: true, + user: { + select: { + id: true, + name: true, + image: true, + isMachine: true, + }, + }, + }, + orderBy: [{ lastUsed: "desc" }, { createdAt: "desc" }], + take: 100, + }), + prismaNext: ({ db }) => + db.orm.RestrictedToken.where({ + projectId: fixtureValues.projectId, + installationId: null, + }) + .select( + "id", + "name", + "partialKey", + "scopes", + "lastUsed", + "createdAt", + "updatedAt", + ) + .include("user", (user) => + user.select("id", "name", "image", "isMachine"), + ) + .orderBy([ + (token) => token.lastUsed.desc(), + (token) => token.createdAt.desc(), + ]) + .take(100) + .all(), + }, + { + id: "token.update.name", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.restrictedToken.update({ + where: { + id: fixtureValues.restrictedTokenId, + }, + data: { + name: "Updated Runtime SQL Token", + }, + select: { + id: true, + name: true, + partialKey: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.RestrictedToken.where({ + id: fixtureValues.restrictedTokenId, + }) + .select("id", "name", "partialKey", "updatedAt") + .update({ + name: "Updated Runtime SQL Token", + }), + }, + { + id: "token.delete.by-id", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.restrictedToken.delete({ + where: { + id: fixtureValues.restrictedTokenId, + }, + select: { + id: true, + name: true, + partialKey: true, + }, + }), + prismaNext: ({ db }) => + db.orm.RestrictedToken.where({ + id: fixtureValues.restrictedTokenId, + }) + .select("id", "name", "partialKey") + .delete(), + }, + ], +}; + +const webhookModule = { + id: "webhook-runtime-module", + description: + "Module-sized comparison for workspace webhook reads with LinkWebhook includes.", + operations: [ + { + id: "webhook.read.enabled-user-webhooks", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.webhook.findMany({ + where: { + projectId: fixtureValues.projectId, + disabledAt: null, + installationId: null, + }, + select: { + id: true, + name: true, + url: true, + secret: true, + triggers: true, + disabledAt: true, + links: true, + receiver: true, + installationId: true, + }, + orderBy: { + createdAt: "desc", + }, + }), + prismaNext: ({ db }) => + db.orm.Webhook.where({ + projectId: fixtureValues.projectId, + disabledAt: null, + installationId: null, + }) + .select( + "id", + "name", + "url", + "secret", + "triggers", + "disabledAt", + "receiver", + "installationId", + ) + .include("links") + .orderBy((webhook) => webhook.createdAt.desc()) + .all(), + }, + { + id: "webhook.update.url", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.webhook.update({ + where: { + id: fixtureValues.webhookId, + }, + data: { + url: "https://example.com/updated-webhook", + }, + select: { + id: true, + url: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Webhook.where({ id: fixtureValues.webhookId }) + .select("id", "url", "updatedAt") + .update({ + url: "https://example.com/updated-webhook", + }), + }, + { + id: "webhook.delete.by-id", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.webhook.delete({ + where: { + id: fixtureValues.webhookId, + }, + select: { + id: true, + url: true, + projectId: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Webhook.where({ id: fixtureValues.webhookId }) + .select("id", "url", "projectId") + .delete(), + }, + ], +}; + +const installedIntegrationModule = { + id: "installed-integration-runtime-module", + description: + "Module-sized comparison for installed integration lookup and deletion.", + operations: [ + { + id: "installed-integration.read.by-id-with-integration", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.installedIntegration.findUnique({ + where: { + id: fixtureValues.installedIntegrationId, + }, + select: { + id: true, + projectId: true, + userId: true, + integration: { + select: { + id: true, + slug: true, + name: true, + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.InstalledIntegration.where({ + id: fixtureValues.installedIntegrationId, + }) + .select("id", "projectId", "userId") + .include("integration", (integration) => + integration.select("id", "slug", "name"), + ) + .first(), + }, + { + id: "installed-integration.delete.by-id", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.installedIntegration.delete({ + where: { + id: fixtureValues.installedIntegrationId, + }, + select: { + id: true, + projectId: true, + integrationId: true, + }, + }), + prismaNext: ({ db }) => + db.orm.InstalledIntegration.where({ + id: fixtureValues.installedIntegrationId, + }) + .select("id", "projectId", "integrationId") + .delete(), + }, + ], +}; + +const domainModule = { + id: "domain-runtime-module", + description: "Module-sized comparison for workspace domain scalar reads.", + operations: [ + { + id: "domain.read.workspace-domain-scalars", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.domain.findMany({ + where: { + projectId: fixtureValues.projectId, + archived: false, + }, + select: { + id: true, + slug: true, + verified: true, + placeholder: true, + expiredUrl: true, + notFoundUrl: true, + primary: true, + archived: true, + lastChecked: true, + logo: true, + appleAppSiteAssociation: true, + assetLinks: true, + deepviewData: true, + linkRetentionDays: true, + createdAt: true, + updatedAt: true, + projectId: true, + }, + take: 100, + skip: 0, + }), + prismaNext: ({ db }) => + db.orm.Domain.where({ + projectId: fixtureValues.projectId, + archived: false, + }) + .select( + "id", + "slug", + "verified", + "placeholder", + "expiredUrl", + "notFoundUrl", + "primary", + "archived", + "lastChecked", + "logo", + "appleAppSiteAssociation", + "assetLinks", + "deepviewData", + "linkRetentionDays", + "createdAt", + "updatedAt", + "projectId", + ) + .take(100) + .skip(0) + .all(), + }, + ], +}; + +const programModule = { + id: "program-runtime-module", + description: "Module-sized comparison for basic program fetcher reads.", + operations: [ + { + id: "program.read.by-slug", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.program.findUnique({ + where: { + slug: "runtime-sql-program", + }, + select: { + id: true, + workspaceId: true, + defaultFolderId: true, + defaultGroupId: true, + name: true, + slug: true, + minPayoutAmount: true, + payoutMode: true, + createdAt: true, + addedToMarketplaceAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Program.where({ slug: "runtime-sql-program" }) + .select( + "id", + "workspaceId", + "defaultFolderId", + "defaultGroupId", + "name", + "slug", + "minPayoutAmount", + "payoutMode", + "createdAt", + "addedToMarketplaceAt", + ) + .first(), + }, + { + id: "program.read.marketplace-by-slug", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.program.findUnique({ + where: { + slug: "runtime-sql-program", + addedToMarketplaceAt: { + not: null, + }, + }, + select: { + id: true, + slug: true, + addedToMarketplaceAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Program.where({ slug: "runtime-sql-program" }) + .where((program) => program.addedToMarketplaceAt.isNotNull()) + .select("id", "slug", "addedToMarketplaceAt") + .first(), + }, + ], +}; + +const programNetworkModule = { + id: "program-network-runtime-module", + description: + "Module-sized comparison for marketplace program availability counting.", + operations: [ + { + id: "program-network.read.available-program-count", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => ({ + count: await prisma.program.count({ + where: { + addedToMarketplaceAt: { + not: null, + }, + groups: { + some: { + slug: "default", + applicationFormPublishedAt: { + not: null, + }, + }, + }, + }, + }), + }), + prismaNext: ({ db }) => + db.orm.Program.where((program) => + and( + program.addedToMarketplaceAt.isNotNull(), + program.groups.some((group) => + and( + group.slug.eq("default"), + group.applicationFormPublishedAt.isNotNull(), + ), + ), + ), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })), + }, + { + id: "program-network.aggregate.marketplace-categories", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const rows = await prisma.$queryRaw` + SELECT pc.category, COUNT(p.id) AS _count + FROM "ProgramCategory" pc + JOIN "Program" p ON p.id = pc."programId" + WHERE p."addedToMarketplaceAt" IS NOT NULL + GROUP BY pc.category + ORDER BY _count DESC + `; + return rows.map((row) => ({ + category: row.category, + count: Number(row._count), + })); + }, + prismaNext: async ({ db }) => { + const rows = await db.orm.ProgramCategory.where((programCategory) => + programCategory.program.some((program) => + program.addedToMarketplaceAt.isNotNull(), + ), + ) + .groupBy("category") + .aggregate((aggregate) => ({ + count: aggregate.count(), + })); + return rows + .map((row) => ({ + category: row.category, + count: row.count, + })) + .sort((left, right) => right.count - left.count); + }, + }, + { + id: "program-network.aggregate.marketplace-reward-types", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const [row] = await prisma.$queryRaw` + SELECT + COUNT(pg."clickRewardId") AS "click", + COUNT(pg."leadRewardId") AS "lead", + COUNT(pg."saleRewardId") AS "sale", + COUNT(pg."discountId") AS "discount" + FROM "PartnerGroup" pg + JOIN "Program" p ON p.id = pg."programId" + WHERE pg.slug = 'default' + AND p."addedToMarketplaceAt" IS NOT NULL + `; + return { + click: Number(row.click), + lead: Number(row.lead), + sale: Number(row.sale), + discount: Number(row.discount), + }; + }, + prismaNext: async ({ db }) => { + const marketplaceDefaultGroup = (group) => + and( + group.slug.eq("default"), + group.program.some((program) => + program.addedToMarketplaceAt.isNotNull(), + ), + ); + const click = await db.orm.PartnerGroup.where((group) => + and(marketplaceDefaultGroup(group), group.clickRewardId.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const lead = await db.orm.PartnerGroup.where((group) => + and(marketplaceDefaultGroup(group), group.leadRewardId.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const sale = await db.orm.PartnerGroup.where((group) => + and(marketplaceDefaultGroup(group), group.saleRewardId.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const discount = await db.orm.PartnerGroup.where((group) => + and(marketplaceDefaultGroup(group), group.discountId.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + + return { + click: click.count, + lead: lead.count, + sale: sale.count, + discount: discount.count, + }; + }, + }, + ], +}; + +const partnerGroupModule = { + id: "partner-group-runtime-module", + description: + "Module-sized comparison for partner group list reads with expanded enrollment counters.", + operations: [ + { + id: "partner-group.read.expanded-list", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const groups = await prisma.$queryRaw` + SELECT + pg.id, + pg."programId", + pg.name, + pg.slug, + pg.color, + pg."clickRewardId", + pg."leadRewardId", + pg."saleRewardId", + pg."discountId", + pg."additionalLinks", + pg."maxPartnerLinks", + pg."linkStructure", + pg."applicationFormPublishedAt", + pg."landerPublishedAt", + pg."createdAt", + pg."updatedAt", + COUNT(DISTINCT pe."partnerId") as "totalPartners", + COALESCE(SUM(pe."totalClicks"), 0) as "totalClicks", + COALESCE(SUM(pe."totalLeads"), 0) as "totalLeads", + COALESCE(SUM(pe."totalSales"), 0) as "totalSales", + COALESCE(SUM(pe."totalSaleAmount"), 0) as "totalSaleAmount", + COALESCE(SUM(pe."totalConversions"), 0) as "totalConversions", + COALESCE(SUM(pe."totalCommissions"), 0) as "totalCommissions", + COALESCE(SUM(pe."totalSaleAmount"), 0) - COALESCE(SUM(pe."totalCommissions"), 0) as "netRevenue" + FROM "PartnerGroup" pg + LEFT JOIN "ProgramEnrollment" pe + ON pe."groupId" = pg.id AND pe.status = 'approved' + WHERE pg."programId" = ${fixtureValues.programId} + GROUP BY pg.id + ORDER BY "totalPartners" DESC + LIMIT 10 OFFSET 0 + `; + + return groups.map((group) => ({ + ...group, + totalPartners: Number(group.totalPartners), + totalClicks: Number(group.totalClicks), + totalLeads: Number(group.totalLeads), + totalSales: Number(group.totalSales), + totalSaleAmount: Number(group.totalSaleAmount), + totalConversions: Number(group.totalConversions), + totalCommissions: Number(group.totalCommissions), + netRevenue: Number(group.netRevenue), + })); + }, + prismaNext: async ({ db }) => { + const sum = (rows, field) => + rows.reduce((total, row) => total + Number(row[field] ?? 0), 0); + const groups = await db.orm.PartnerGroup.where({ + programId: fixtureValues.programId, + }) + .select( + "id", + "programId", + "name", + "slug", + "color", + "clickRewardId", + "leadRewardId", + "saleRewardId", + "discountId", + "additionalLinks", + "maxPartnerLinks", + "linkStructure", + "applicationFormPublishedAt", + "landerPublishedAt", + "createdAt", + "updatedAt", + ) + .include("partners", (partners) => + partners + .where({ status: "approved" }) + .select( + "partnerId", + "totalClicks", + "totalLeads", + "totalSales", + "totalSaleAmount", + "totalConversions", + "totalCommissions", + ), + ) + .take(10) + .all() + .toArray(); + + return groups + .map(({ partners, ...group }) => ({ + ...group, + totalPartners: new Set( + partners.map((enrollment) => enrollment.partnerId), + ).size, + totalClicks: sum(partners, "totalClicks"), + totalLeads: sum(partners, "totalLeads"), + totalSales: sum(partners, "totalSales"), + totalSaleAmount: sum(partners, "totalSaleAmount"), + totalConversions: sum(partners, "totalConversions"), + totalCommissions: sum(partners, "totalCommissions"), + netRevenue: + sum(partners, "totalSaleAmount") - + sum(partners, "totalCommissions"), + })) + .sort((left, right) => right.totalPartners - left.totalPartners); + }, + }, + ], +}; + +const programApplicationModule = { + id: "program-application-runtime-module", + description: + "Module-sized comparison for program applications and application event funnel reads.", + operations: [ + { + id: "program-application.read.pending-for-program", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.programApplication.findMany({ + where: { + programId: fixtureValues.programId, + reviewedAt: null, + }, + select: { + id: true, + programId: true, + groupId: true, + name: true, + email: true, + country: true, + formData: true, + createdAt: true, + }, + orderBy: { + createdAt: "asc", + }, + }), + prismaNext: ({ db }) => + db.orm.ProgramApplication.where((application) => + and( + application.programId.eq(fixtureValues.programId), + application.reviewedAt.isNull(), + ), + ) + .select( + "id", + "programId", + "groupId", + "name", + "email", + "country", + "formData", + "createdAt", + ) + .orderBy((application) => application.createdAt.asc()) + .all(), + }, + { + id: "program-application.update.reject", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.programApplication.update({ + where: { + id: fixtureValues.programApplicationId, + }, + data: { + userId: fixtureValues.userId, + rejectionReason: "needsMoreDetail", + rejectionNote: "Runtime SQL rejection note", + reviewedAt: new Date("2024-01-17T03:00:00.000Z"), + }, + select: { + id: true, + userId: true, + rejectionReason: true, + reviewedAt: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.ProgramApplication.where({ + id: fixtureValues.programApplicationId, + }) + .select("id", "userId", "rejectionReason", "reviewedAt", "updatedAt") + .update({ + userId: fixtureValues.userId, + rejectionReason: "needsMoreDetail", + rejectionNote: "Runtime SQL rejection note", + reviewedAt: new Date("2024-01-17T03:00:00.000Z"), + }), + }, + { + id: "program-application-event.aggregate.funnel-summary", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const [row] = await prisma.$queryRaw` + SELECT + COUNT("visitedAt") AS visits, + COUNT("startedAt") AS starts, + COUNT("submittedAt") AS submissions, + COUNT("approvedAt") AS approvals, + COUNT("rejectedAt") AS rejections + FROM "ProgramApplicationEvent" + WHERE "programId" = ${fixtureValues.programId} + AND "visitedAt" >= ${new Date("2024-01-17T00:00:00.000Z")} + AND "visitedAt" < ${new Date("2024-01-18T00:00:00.000Z")} + `; + + return { + visits: Number(row.visits), + starts: Number(row.starts), + submissions: Number(row.submissions), + approvals: Number(row.approvals), + rejections: Number(row.rejections), + }; + }, + prismaNext: async ({ db }) => { + const dateRange = (event) => + and( + event.programId.eq(fixtureValues.programId), + event.visitedAt.gte(new Date("2024-01-17T00:00:00.000Z")), + event.visitedAt.lt(new Date("2024-01-18T00:00:00.000Z")), + ); + const visits = await db.orm.ProgramApplicationEvent.where( + dateRange, + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const starts = await db.orm.ProgramApplicationEvent.where((event) => + and(dateRange(event), event.startedAt.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const submissions = await db.orm.ProgramApplicationEvent.where( + (event) => and(dateRange(event), event.submittedAt.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const approvals = await db.orm.ProgramApplicationEvent.where((event) => + and(dateRange(event), event.approvedAt.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + const rejections = await db.orm.ProgramApplicationEvent.where((event) => + and(dateRange(event), event.rejectedAt.isNotNull()), + ).aggregate((aggregate) => ({ + count: aggregate.count(), + })); + + return { + visits: visits.count, + starts: starts.count, + submissions: submissions.count, + approvals: approvals.count, + rejections: rejections.count, + }; + }, + }, + { + id: "program-application-event.read.referred-by-partner", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.programApplicationEvent.findMany({ + where: { + programId: fixtureValues.programId, + referredByPartnerId: fixtureValues.partnerId, + }, + select: { + id: true, + referralSource: true, + country: true, + application: { + select: { + id: true, + email: true, + }, + }, + }, + orderBy: { + visitedAt: "asc", + }, + }), + prismaNext: ({ db }) => + db.orm.ProgramApplicationEvent.where((event) => + and( + event.programId.eq(fixtureValues.programId), + event.referredByPartnerId.eq(fixtureValues.partnerId), + ), + ) + .select("id", "referralSource", "country") + .include("application", (application) => + application.select("id", "email"), + ) + .orderBy((event) => event.visitedAt.asc()) + .all(), + }, + ], +}; + +const bountyModule = { + id: "bounty-runtime-module", + description: + "Module-sized comparison for bounty details, grouped submission counts, and review writes.", + operations: [ + { + id: "bounty.read.details-with-groups", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const [bounty] = await prisma.$queryRaw` + SELECT + b.id, + b.name, + b.description, + b.type, + b."startsAt", + b."endsAt", + b."submissionsOpenAt", + b."submissionFrequency", + b."maxSubmissions", + b."rewardAmount", + b."rewardDescription", + b."submissionRequirements", + b."socialMetricsLastSyncedAt", + b."performanceScope", + wf."triggerConditions", + COALESCE( + ( + SELECT jsonb_agg( + jsonb_build_object('id', "groupId") + ) + FROM "BountyGroup" + WHERE "bountyId" = b.id + ), + '[]'::jsonb + ) AS "groups" + FROM "Bounty" b + LEFT JOIN "Workflow" wf ON wf.id = b."workflowId" + WHERE b.id = ${fixtureValues.bountyId} + AND b."programId" = ${fixtureValues.programId} + LIMIT 1 + `; + + return { + id: bounty.id, + name: bounty.name, + description: bounty.description, + type: bounty.type, + startsAt: bounty.startsAt, + endsAt: bounty.endsAt, + submissionsOpenAt: bounty.submissionsOpenAt, + submissionFrequency: bounty.submissionFrequency, + maxSubmissions: bounty.maxSubmissions, + rewardAmount: bounty.rewardAmount, + rewardDescription: bounty.rewardDescription, + submissionRequirements: bounty.submissionRequirements, + socialMetricsLastSyncedAt: bounty.socialMetricsLastSyncedAt ?? null, + performanceScope: bounty.performanceScope, + performanceCondition: + bounty.triggerConditions?.length > 0 + ? bounty.triggerConditions[0] + : null, + groups: (bounty.groups ?? []).filter((group) => group !== null), + }; + }, + prismaNext: async ({ db }) => { + const bounty = await db.orm.Bounty.where({ + id: fixtureValues.bountyId, + programId: fixtureValues.programId, + }) + .select( + "id", + "name", + "description", + "type", + "startsAt", + "endsAt", + "submissionsOpenAt", + "submissionFrequency", + "maxSubmissions", + "rewardAmount", + "rewardDescription", + "submissionRequirements", + "socialMetricsLastSyncedAt", + "performanceScope", + ) + .include("workflow", (workflow) => + workflow.select("triggerConditions"), + ) + .include("groups", (groups) => groups.select("groupId")) + .first(); + + return { + id: bounty.id, + name: bounty.name, + description: bounty.description, + type: bounty.type, + startsAt: bounty.startsAt, + endsAt: bounty.endsAt, + submissionsOpenAt: bounty.submissionsOpenAt, + submissionFrequency: bounty.submissionFrequency, + maxSubmissions: bounty.maxSubmissions, + rewardAmount: bounty.rewardAmount, + rewardDescription: bounty.rewardDescription, + submissionRequirements: bounty.submissionRequirements, + socialMetricsLastSyncedAt: bounty.socialMetricsLastSyncedAt ?? null, + performanceScope: bounty.performanceScope, + performanceCondition: + bounty.workflow?.triggerConditions?.length > 0 + ? bounty.workflow.triggerConditions[0] + : null, + groups: bounty.groups.map((group) => ({ id: group.groupId })), + }; + }, + }, + { + id: "bounty-submission.aggregate.by-status", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: async ({ prisma }) => { + const rows = await prisma.bountySubmission.groupBy({ + by: ["status"], + where: { + bountyId: fixtureValues.bountyId, + }, + _count: { + id: true, + }, + orderBy: { + status: "asc", + }, + }); + return rows.map((row) => ({ + status: row.status, + count: row._count.id, + })); + }, + prismaNext: async ({ db }) => { + const rows = await db.orm.BountySubmission.where({ + bountyId: fixtureValues.bountyId, + }) + .groupBy("status") + .aggregate((aggregate) => ({ + count: aggregate.count(), + })); + return rows + .map((row) => ({ + status: row.status, + count: row.count, + })) + .sort((left, right) => left.status.localeCompare(right.status)); + }, + }, + { + id: "bounty-submission.update.approve", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.bountySubmission.update({ + where: { + id: fixtureValues.bountySubmissionId, + }, + data: { + status: "approved", + userId: fixtureValues.userId, + reviewedAt: new Date("2024-01-18T04:00:00.000Z"), + }, + select: { + id: true, + status: true, + userId: true, + reviewedAt: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.BountySubmission.where({ + id: fixtureValues.bountySubmissionId, + }) + .select("id", "status", "userId", "reviewedAt", "updatedAt") + .update({ + status: "approved", + userId: fixtureValues.userId, + reviewedAt: new Date("2024-01-18T04:00:00.000Z"), + }), + }, + ], +}; + +const partnerModule = { + id: "partner-runtime-module", + description: "Module-sized comparison for partner profile reads.", + operations: [ + { + id: "partner.read.by-id", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.partner.findUnique({ + where: { + id: fixtureValues.partnerId, + }, + select: { + id: true, + name: true, + email: true, + image: true, + country: true, + payoutsEnabledAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Partner.where({ id: fixtureValues.partnerId }) + .select("id", "name", "email", "image", "country", "payoutsEnabledAt") + .first(), + }, + { + id: "partner.update.name", + kind: "write", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.partner.update({ + where: { + id: fixtureValues.partnerId, + }, + data: { + name: "Updated Runtime SQL Partner", + }, + select: { + id: true, + name: true, + email: true, + updatedAt: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Partner.where({ + id: fixtureValues.partnerId, + }) + .select("id", "name", "email", "updatedAt") + .update({ + name: "Updated Runtime SQL Partner", + }), + }, + ], +}; + +const programEnrollmentModule = { + id: "program-enrollment-runtime-module", + description: + "Module-sized comparison for program enrollment compound-key reads.", + operations: [ + { + id: "program-enrollment.read.by-partner-program", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.programEnrollment.findUnique({ + where: { + partnerId_programId: { + partnerId: fixtureValues.partnerId, + programId: fixtureValues.programId, + }, + }, + select: { + id: true, + partnerId: true, + programId: true, + tenantId: true, + groupId: true, + status: true, + totalClicks: true, + totalCommissions: true, + }, + }), + prismaNext: ({ db }) => + db.orm.ProgramEnrollment.where({ + partnerId: fixtureValues.partnerId, + programId: fixtureValues.programId, + }) + .select( + "id", + "partnerId", + "programId", + "tenantId", + "groupId", + "status", + "totalClicks", + "totalCommissions", + ) + .first(), + }, + { + id: "program-enrollment.read.approved-with-partner", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.programEnrollment.findMany({ + where: { + programId: fixtureValues.programId, + status: "approved", + }, + select: { + id: true, + partnerId: true, + programId: true, + status: true, + partner: { + select: { + id: true, + name: true, + email: true, + image: true, + }, + }, + }, + }), + prismaNext: ({ db }) => + db.orm.ProgramEnrollment.where({ + programId: fixtureValues.programId, + status: "approved", + }) + .select("id", "partnerId", "programId", "status") + .include("partner", (partner) => + partner.select("id", "name", "email", "image"), + ) + .all(), + }, + ], +}; + +const customerModule = { + id: "customer-runtime-module", + description: "Module-sized comparison for customer cursor and list reads.", + operations: [ + { + id: "customer.read.cursor-validation", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.customer.findUnique({ + where: { + id: fixtureValues.customerId, + }, + select: { + id: true, + projectId: true, + }, + }), + prismaNext: ({ db }) => + db.orm.Customer.where({ id: fixtureValues.customerId }) + .select("id", "projectId") + .first(), + }, + { + id: "customer.read.list-for-workspace-program-partner", + kind: "read", + setup: ({ pool }) => + resetRuntimeFixture(pool, { includeDashboard: false }), + prisma6: ({ prisma }) => + prisma.customer.findMany({ + where: { + projectId: fixtureValues.projectId, + programId: fixtureValues.programId, + partnerId: fixtureValues.partnerId, + }, + select: { + id: true, + name: true, + email: true, + externalId: true, + country: true, + projectId: true, + programId: true, + partnerId: true, + createdAt: true, + }, + orderBy: { + createdAt: "desc", + }, + take: 100, + }), + prismaNext: ({ db }) => + db.orm.Customer.where({ + projectId: fixtureValues.projectId, + programId: fixtureValues.programId, + partnerId: fixtureValues.partnerId, + }) + .select( + "id", + "name", + "email", + "externalId", + "country", + "projectId", + "programId", + "partnerId", + "createdAt", + ) + .orderBy((customer) => customer.createdAt.desc()) + .take(100) + .all(), + }, + ], +}; + +const runtimeModules = [ + dashboardModule, + userModule, + linkModule, + edgeLinkModule, + analyticsModule, + commissionsPayoutsModule, + notificationEmailModule, + postbackModule, + usageCounterModule, + workspaceProductModule, + workspaceModule, + edgeWorkspaceModule, + folderModule, + integrationModule, + tagModule, + tokenModule, + webhookModule, + installedIntegrationModule, + domainModule, + programModule, + programNetworkModule, + partnerGroupModule, + programApplicationModule, + bountyModule, + partnerModule, + programEnrollmentModule, + customerModule, +]; + +async function capture(label, collector, runOperation) { + collector.start(); + try { + const result = await runOperation(); + return { + ok: true, + result: summarizeResult(result), + queries: collector.entries.map(summarizeQuery), + queryEvents: collector.queryEvents, + }; + } catch (error) { + return { + ok: false, + error: { + name: error?.name, + message: error?.message, + stack: error?.stack, + }, + queries: collector.entries.map(summarizeQuery), + queryEvents: collector.queryEvents, + }; + } finally { + collector.stop(); + } +} + +function compareOperation(prisma6, prismaNext) { + const prisma6ResultTypeShape = typeShape(prisma6.result); + const prismaNextResultTypeShape = typeShape(prismaNext.result); + + return { + prisma6QueryCount: prisma6.queries.length, + prismaNextQueryCount: prismaNext.queries.length, + sameQueryCount: prisma6.queries.length === prismaNext.queries.length, + resultTypeShapeEqual: + stableJson(prisma6ResultTypeShape) === + stableJson(prismaNextResultTypeShape), + resultValueSummaryEqual: + stableJson(prisma6.result) === stableJson(prismaNext.result), + prisma6ResultTypeShape, + prismaNextResultTypeShape, + sqlEqualByPosition: prisma6.queries.map((query, index) => ({ + index, + equal: + query.normalizedSql === prismaNext.queries[index]?.normalizedSql && + stableJson(query.params) === + stableJson(prismaNext.queries[index]?.params), + })), + }; +} + +async function runModuleComparison( + moduleDefinition, + prisma6Context, + prismaNextContext, +) { + const operations = []; + + for (const operation of moduleDefinition.operations) { + await operation.setup({ pool: prisma6Context.seedPool }); + await operation.setup({ pool: prismaNextContext.seedPool }); + const fixtureBefore = { + prisma6: await snapshotRuntimeFixture(prisma6Context.seedPool), + prismaNext: await snapshotRuntimeFixture(prismaNextContext.seedPool), + }; + + const prisma6 = await capture("prisma6", prisma6Context.collector, () => + operation.prisma6({ prisma: prisma6Context.client }), + ); + const prismaNext = await capture( + "prismaNext", + prismaNextContext.collector, + () => operation.prismaNext({ db: prismaNextContext.db }), + ); + const fixtureAfter = { + prisma6: await snapshotRuntimeFixture(prisma6Context.seedPool), + prismaNext: await snapshotRuntimeFixture(prismaNextContext.seedPool), + }; + + operations.push({ + id: operation.id, + kind: operation.kind, + fixtureBefore: compareSnapshots( + fixtureBefore.prisma6, + fixtureBefore.prismaNext, + ), + fixtureAfter: compareSnapshots( + fixtureAfter.prisma6, + fixtureAfter.prismaNext, + ), + prisma6, + prismaNext, + comparison: compareOperation(prisma6, prismaNext), + }); + } + + return { + id: moduleDefinition.id, + description: moduleDefinition.description, + operations, + }; +} + +async function main() { + const suffix = `${process.pid}_${Date.now()}`; + const prisma6Db = `dub_runtime_sql_p6_${suffix}`; + const prismaNextDb = `dub_runtime_sql_pn_${suffix}`; + const prisma6AdminPool = new Pool({ + connectionString: adminDatabaseUrlFor(prisma6RootDatabaseUrl), + }); + const prismaNextAdminPool = new Pool({ + connectionString: adminDatabaseUrlFor(prismaNextRootDatabaseUrl), + }); + + let prisma6; + let prisma6Pool; + let prisma6SeedPool; + let prismaNext; + let prismaNextRuntime; + let prismaNextSeedPool; + + try { + await createDatabase(prisma6AdminPool, prisma6Db); + await createDatabase(prismaNextAdminPool, prismaNextDb); + + const prisma6Url = databaseUrlFor(prisma6RootDatabaseUrl, prisma6Db); + const prismaNextUrl = databaseUrlFor( + prismaNextRootDatabaseUrl, + prismaNextDb, + ); + prisma6SeedPool = new Pool({ connectionString: prisma6Url }); + prismaNextSeedPool = new Pool({ connectionString: prismaNextUrl }); + + await createRuntimeComparisonSchema(prisma6SeedPool); + await createRuntimeComparisonSchema(prismaNextSeedPool); + + const prisma6Collector = new QueryCollector("prisma6"); + const prisma6Client = createPrisma6Client(prisma6Url, prisma6Collector); + prisma6 = prisma6Client.client; + prisma6Pool = prisma6Client.pool; + await prisma6.$connect(); + + const prismaNextCollector = new QueryCollector("prismaNext"); + prismaNext = createPrismaNextClient(prismaNextUrl, prismaNextCollector); + prismaNextRuntime = await prismaNext.connect(); + + const moduleReports = []; + for (const moduleDefinition of runtimeModules) { + moduleReports.push( + await runModuleComparison( + moduleDefinition, + { + client: prisma6, + collector: prisma6Collector, + seedPool: prisma6SeedPool, + }, + { + db: prismaNext, + collector: prismaNextCollector, + seedPool: prismaNextSeedPool, + }, + ), + ); + } + + const report = { + generatedAt: new Date().toISOString(), + isolation: { + mode: + prisma6RootDatabaseUrl === prismaNextRootDatabaseUrl + ? "two-scratch-databases-on-one-postgres-root" + : "two-scratch-databases-on-separate-postgres-roots", + prisma6RootDatabaseUrl: describeDatabaseUrl(prisma6RootDatabaseUrl), + prismaNextRootDatabaseUrl: describeDatabaseUrl( + prismaNextRootDatabaseUrl, + ), + prisma6Database: prisma6Db, + prismaNextDatabase: prismaNextDb, + }, + strategy: { + prisma6: + "Capture exact SQL and driver parameters at the pg Pool boundary used by @prisma/adapter-pg, plus Prisma Client query events.", + prismaNext: + "Capture exact lowered SQL, encoded parameters, and plan metadata in Prisma Next middleware before driver execution.", + resultShapes: + "Execute equivalent module operations against isolated scratch databases seeded from the same fixture, then summarize JS result constructors and field shapes.", + databaseState: + "Record before/after fixture snapshots for both databases so write operations can be compared without either runtime influencing the other dataset.", + }, + modules: moduleReports, + }; + + mkdirSync(dirname(outputPath), { recursive: true }); + writeFileSync(outputPath, `${stableJson(report)}\n`); + + for (const moduleReport of report.modules) { + console.log( + `${moduleReport.id}: ${moduleReport.operations.length} operations`, + ); + for (const operation of moduleReport.operations) { + const { comparison } = operation; + console.log( + ` - ${operation.id}: Prisma 6 queries=${comparison.prisma6QueryCount}, Prisma Next queries=${comparison.prismaNextQueryCount}, resultTypeShapeEqual=${comparison.resultTypeShapeEqual}, fixtureBeforeEqual=${operation.fixtureBefore.valueEqual}, fixtureAfterEqual=${operation.fixtureAfter.valueEqual}`, + ); + if (!operation.fixtureBefore.valueEqual) { + console.log( + ` fixtureBefore differs: Prisma 6=${operation.fixtureBefore.prisma6Hash}, Prisma Next=${operation.fixtureBefore.prismaNextHash}`, + ); + } + } + } + console.log(`Runtime SQL comparison written to ${outputPath}`); + } finally { + await prisma6?.$disconnect().catch(() => undefined); + await prisma6Pool?.end().catch(() => undefined); + await prismaNextRuntime?.close().catch(() => undefined); + await prisma6SeedPool?.end().catch(() => undefined); + await prismaNextSeedPool?.end().catch(() => undefined); + await dropDatabase(prisma6AdminPool, prisma6Db).catch(() => undefined); + await dropDatabase(prismaNextAdminPool, prismaNextDb).catch( + () => undefined, + ); + await prisma6AdminPool.end(); + await prismaNextAdminPool.end(); + } +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/prisma/scripts/prisma-next-smoke.mjs b/packages/prisma/scripts/prisma-next-smoke.mjs new file mode 100644 index 00000000000..9155edc431b --- /dev/null +++ b/packages/prisma/scripts/prisma-next-smoke.mjs @@ -0,0 +1,182 @@ +import { Pool } from "pg"; +import { prismaNext } from "../next.mjs"; + +const baseDatabaseUrl = + process.env.DATABASE_URL ?? "postgresql://postgres:postgres@localhost:5432/dub"; + +const quoteIdent = (value) => `"${value.replace(/"/g, '""')}"`; + +const databaseUrlFor = (databaseName) => { + const url = new URL(baseDatabaseUrl); + url.pathname = `/${databaseName}`; + return url.toString(); +}; + +const adminDatabaseUrl = () => { + const url = new URL(baseDatabaseUrl); + url.pathname = "/postgres"; + return url.toString(); +}; + +async function createDatabase(pool, name) { + await pool.query(`CREATE DATABASE ${quoteIdent(name)}`); +} + +async function dropDatabase(pool, name) { + await pool.query("select pg_terminate_backend(pid) from pg_stat_activity where datname = $1", [ + name, + ]); + await pool.query(`DROP DATABASE IF EXISTS ${quoteIdent(name)}`); +} + +async function prepareSmokeSchema(databaseUrl) { + const pool = new Pool({ connectionString: databaseUrl }); + try { + await pool.query("create schema if not exists prisma_contract"); + await pool.query(` + create table if not exists prisma_contract.marker ( + space text not null primary key default 'app', + core_hash text not null, + profile_hash text not null, + contract_json jsonb, + canonical_version int, + updated_at timestamptz not null default now(), + app_tag text, + meta jsonb not null default '{}', + invariants text[] not null default '{}' + ) + `); + await pool.query(` + create table "User" ( + "id" char(24) primary key + ) + `); + await pool.query(` + create table "Dashboard" ( + "id" char(24) primary key, + "password" text, + "doIndex" boolean not null default false, + "showConversions" boolean not null default false, + "createdAt" timestamptz not null default now(), + "updatedAt" timestamptz not null + ) + `); + } finally { + await pool.end(); + } +} + +const asDate = (value) => { + const date = value instanceof Date ? value : new Date(String(value)); + if (Number.isNaN(date.getTime())) { + throw new Error(`Expected a timestamp, got ${String(value)}`); + } + return date; +}; + +const getRoot = (roots, name) => { + const root = roots[name] ?? roots[name[0].toLowerCase() + name.slice(1)]; + if (!root) { + throw new Error(`Prisma Next SQL root not found for ${name}`); + } + return root; +}; + +async function main() { + const databaseName = `dub_next_smoke_${process.pid}_${Date.now()}`; + const adminPool = new Pool({ connectionString: adminDatabaseUrl() }); + const databaseUrl = databaseUrlFor(databaseName); + let runtime; + const marker = `prisma-next-smoke-${Date.now()}`; + let dashboardId; + + try { + await createDatabase(adminPool, databaseName); + await prepareSmokeSchema(databaseUrl); + + runtime = await prismaNext.connect({ url: databaseUrl }); + const user = getRoot(prismaNext.sql, "User"); + const dashboard = getRoot(prismaNext.sql, "Dashboard"); + + await runtime.execute(user.select("id").limit(1).build()); + + const createdRows = await runtime.execute( + dashboard + .insert({ password: marker }) + .returning("id", "password", "createdAt", "updatedAt") + .build(), + ); + const created = createdRows[0]; + if (!created) { + throw new Error("Dashboard create did not return a row"); + } + dashboardId = created.id; + + const createdAt = asDate(created.createdAt); + const createdUpdatedAt = asDate(created.updatedAt); + if (createdUpdatedAt.getTime() < createdAt.getTime() - 5_000) { + throw new Error("@updatedAt create default was not populated as expected"); + } + + await new Promise((resolve) => setTimeout(resolve, 20)); + + const updatedRows = await runtime.execute( + dashboard + .update({ password: `${marker}:updated` }) + .where((fields, fns) => fns.eq(fields.id, dashboardId)) + .returning("id", "password", "updatedAt") + .build(), + ); + const updated = updatedRows[0]; + if (!updated) { + throw new Error("Dashboard update did not return a row"); + } + const updatedAt = asDate(updated.updatedAt); + if (updatedAt.getTime() < createdUpdatedAt.getTime()) { + throw new Error("@updatedAt update default did not advance"); + } + + const explicitUpdatedAt = new Date("2001-02-03T04:05:06.000Z"); + const explicitRows = await runtime.execute( + dashboard + .update({ + password: `${marker}:explicit`, + updatedAt: explicitUpdatedAt, + }) + .where((fields, fns) => fns.eq(fields.id, dashboardId)) + .returning("id", "password", "updatedAt") + .build(), + ); + const explicit = explicitRows[0]; + if (!explicit) { + throw new Error("Dashboard explicit updatedAt update did not return a row"); + } + if (asDate(explicit.updatedAt).getTime() !== explicitUpdatedAt.getTime()) { + throw new Error("Explicit updatedAt value was overwritten"); + } + + console.log("Prisma Next smoke passed."); + } finally { + if (dashboardId && runtime) { + const dashboard = getRoot(prismaNext.sql, "Dashboard"); + try { + await runtime.execute( + dashboard + .delete() + .where((fields, fns) => fns.eq(fields.id, dashboardId)) + .build(), + ); + } catch { + // The scratch database is dropped below; cleanup here is best-effort. + } + } + await runtime?.close(); + await dropDatabase(adminPool, databaseName).catch(() => undefined); + await adminPool.end(); + } +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/prisma/scripts/prisma6-cli.ts b/packages/prisma/scripts/prisma6-cli.ts new file mode 100644 index 00000000000..cbf2d736b13 --- /dev/null +++ b/packages/prisma/scripts/prisma6-cli.ts @@ -0,0 +1,51 @@ +import { copyFileSync, mkdirSync, mkdtempSync, readdirSync, rmSync } from "node:fs"; +import { basename, join } from "node:path"; +import { spawnSync } from "node:child_process"; + +const schemaDir = join(process.cwd(), "schema"); +const tempRoot = join(process.cwd(), ".tmp"); +mkdirSync(tempRoot, { recursive: true }); +const tempSchemaDir = mkdtempSync(join(tempRoot, "prisma6-schema-")); +const commandArgs = process.argv.slice(2); + +if (commandArgs.length === 0) { + throw new Error("Usage: tsx scripts/prisma6-cli.ts "); +} + +const schemaFiles = readdirSync(schemaDir).filter( + (file) => file.endsWith(".prisma") && file !== "contract.prisma", +); + +for (const file of schemaFiles) { + copyFileSync(join(schemaDir, file), join(tempSchemaDir, file)); +} + +const isFormat = commandArgs[0] === "format"; + +try { + const result = spawnSync( + "pnpm", + ["exec", "prisma", ...commandArgs, "--schema", tempSchemaDir], + { + stdio: "inherit", + env: process.env, + }, + ); + + if (result.error) { + throw result.error; + } + + if (result.status !== 0) { + process.exitCode = result.status ?? 1; + process.exit(); + } + + if (isFormat) { + for (const file of schemaFiles) { + copyFileSync(join(tempSchemaDir, basename(file)), join(schemaDir, file)); + } + } +} finally { + rmSync(tempSchemaDir, { recursive: true, force: true }); +} diff --git a/packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz new file mode 100644 index 00000000000..88031448cdc Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz new file mode 100644 index 00000000000..3ae37d1cecb Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz new file mode 100644 index 00000000000..b9e000af1b0 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz new file mode 100644 index 00000000000..ffedd143f9c Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz new file mode 100644 index 00000000000..0d56aa10a0e Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz new file mode 100644 index 00000000000..5035e755adc Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz new file mode 100644 index 00000000000..bc779e29e28 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz new file mode 100644 index 00000000000..2e9adb73989 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz new file mode 100644 index 00000000000..b478188c1b7 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz new file mode 100644 index 00000000000..9b8b7c63ad8 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz new file mode 100644 index 00000000000..9b70ed11db4 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz new file mode 100644 index 00000000000..47329893c4e Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz new file mode 100644 index 00000000000..50585b3453c Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz new file mode 100644 index 00000000000..0634429fccf Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz new file mode 100644 index 00000000000..270bc92b6c4 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz new file mode 100644 index 00000000000..b06a03e1009 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz new file mode 100644 index 00000000000..d424084c0f9 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz new file mode 100644 index 00000000000..e1adf2a985b Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz new file mode 100644 index 00000000000..6799446dfa6 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz new file mode 100644 index 00000000000..64f467d1b9c Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz new file mode 100644 index 00000000000..9e99d583d05 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz new file mode 100644 index 00000000000..5851d1ba5ad Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz new file mode 100644 index 00000000000..0772206adc4 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz new file mode 100644 index 00000000000..39451325276 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz new file mode 100644 index 00000000000..8fe11278f2e Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz new file mode 100644 index 00000000000..980ec947bb4 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz new file mode 100644 index 00000000000..8a09ccd13b5 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz new file mode 100644 index 00000000000..9224bac0844 Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz new file mode 100644 index 00000000000..69c7ca1ca0d Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz differ diff --git a/packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz b/packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz new file mode 100644 index 00000000000..42ab97552ee Binary files /dev/null and b/packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz differ diff --git a/packages/tinybird/pipes/v4_group_by_link_metadata.pipe b/packages/tinybird/pipes/v4_group_by_link_metadata.pipe index 96f495612ac..a0f4d54d429 100644 --- a/packages/tinybird/pipes/v4_group_by_link_metadata.pipe +++ b/packages/tinybird/pipes/v4_group_by_link_metadata.pipe @@ -4,7 +4,7 @@ SQL > % SELECT link_id, - -- here we don't wrap tag_ids and partner_tag_ids in array() + -- here we don't wrap tag_ids and partner_tag_ids in array() -- because the parent arrayJoin explodes rows arrayJoin( multiIf( @@ -588,4 +588,3 @@ SQL > {% else %} group_by_link_metadata_clicks {% end %} - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 502d27673cf..0d2c400cb2c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,36 @@ settings: overrides: chrono-node: 2.7.5 + '@prisma-next/adapter-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz + '@prisma-next/cli': file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz + '@prisma-next/config': file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/contract-authoring': file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz + '@prisma-next/driver-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz + '@prisma-next/emitter': file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz + '@prisma-next/errors': file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz + '@prisma-next/family-sql': file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/ids': file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz + '@prisma-next/migration-tools': file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/postgres': file:packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz + '@prisma-next/psl-parser': file:packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz + '@prisma-next/psl-printer': file:packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz + '@prisma-next/sql-builder': file:packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-contract-emitter': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz + '@prisma-next/sql-contract-psl': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz + '@prisma-next/sql-contract-ts': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz + '@prisma-next/sql-errors': file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-orm-client': file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/sql-runtime': file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz + '@prisma-next/sql-schema-ir': file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz + '@prisma-next/target-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz + '@prisma-next/ts-render': file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz importers: @@ -98,9 +128,6 @@ importers: '@number-flow/react': specifier: ^0.4.1 version: 0.4.1(react-dom@19.1.3(react@19.1.3))(react@19.1.3) - '@planetscale/database': - specifier: ^1.18.0 - version: 1.18.0 '@prisma/nextjs-monorepo-workaround-plugin': specifier: ^6.19.1 version: 6.19.1 @@ -320,6 +347,9 @@ importers: openid-client: specifier: ^6.8.0 version: 6.8.0 + pg: + specifier: 8.16.0 + version: 8.16.0 react: specifier: 19.1.3 version: 19.1.3 @@ -420,6 +450,9 @@ importers: '@types/node': specifier: 18.11.9 version: 18.11.9 + '@types/pg': + specifier: 8.11.11 + version: 8.11.11 '@types/react': specifier: 19.1.14 version: 19.1.14 @@ -663,7 +696,7 @@ importers: dependencies: '@hubspot/cli': specifier: ^7.6.2 - version: 7.6.2(@babel/core@7.24.5)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.6.2)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0)(typescript@5.6.2)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) + version: 7.6.2(@babel/core@7.28.4)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.8.3)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0)(typescript@5.6.2)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) devDependencies: '@types/node': specifier: 18.11.9 @@ -680,19 +713,31 @@ importers: packages/prisma: dependencies: - '@planetscale/database': - specifier: 1.19.0 - version: 1.19.0 - '@prisma/adapter-planetscale': + '@prisma-next/postgres': + specifier: file:vendor/prisma-next/prisma-next-postgres-0.0.1.tgz + version: file:packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz(typanion@3.14.0) + '@prisma-next/sql-orm-client': + specifier: file:vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz + version: file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz + '@prisma/adapter-pg': specifier: 6.19.1 version: 6.19.1 '@prisma/client': specifier: 6.19.1 version: 6.19.1(prisma@6.19.1(typescript@5.2.2))(typescript@5.2.2) + pg: + specifier: 8.16.0 + version: 8.16.0 devDependencies: + '@prisma-next/cli': + specifier: file:vendor/prisma-next/prisma-next-cli-0.0.1.tgz + version: file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz(typanion@3.14.0) '@types/node': specifier: 18.11.9 version: 18.11.9 + '@types/pg': + specifier: 8.11.11 + version: 8.11.11 prisma: specifier: 6.19.1 version: 6.19.1(typescript@5.2.2) @@ -1118,6 +1163,12 @@ packages: '@antfu/utils@0.7.10': resolution: {integrity: sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww==} + '@ark/schema@0.56.0': + resolution: {integrity: sha512-ECg3hox/6Z/nLajxXqNhgPtNdHWC9zNsDyskwO28WinoFEnWow4IsERNz9AnXRhTZJnYIlAJ4uGn3nlLk65vZA==} + + '@ark/util@0.56.0': + resolution: {integrity: sha512-BghfRC8b9pNs3vBoDJhcta0/c1J1rsoS1+HgVUreMFPdhz/CRAKReAu57YEllNaSy98rWAdY1gE+gFup7OXpgA==} + '@asamuzakjp/css-color@3.2.0': resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==} @@ -1614,6 +1665,14 @@ packages: peerDependencies: zod: ^4.0.0 + '@clack/core@1.3.0': + resolution: {integrity: sha512-xJPHpAmEQUBrXSLx0gF+q5K/IyihXpsHZcha+jB+tyahsKRK3Dxo4D0coZDewHo12NhiuzC3dTtMPbm53GEAAA==} + engines: {node: '>= 20.12.0'} + + '@clack/prompts@1.3.0': + resolution: {integrity: sha512-GgcWwRCs/xPtaqlMy8qRhPnZf9vlWcWZNHAitnVQ3yk7JmSralSiq5q07yaffYE8SogtDm7zFeKccx1QNVARpw==} + engines: {node: '>= 20.12.0'} + '@cspotcode/source-map-support@0.8.1': resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} engines: {node: '>=12'} @@ -1650,6 +1709,12 @@ packages: resolution: {integrity: sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==} engines: {node: '>=18'} + '@dagrejs/dagre@3.0.0': + resolution: {integrity: sha512-ZzhnTy1rfuoew9Ez3EIw4L2znPGnYYhfn8vc9c4oB8iw6QAsszbiU0vRhlxWPFnmmNSFAkrYeF1PhM5m4lAN0Q==} + + '@dagrejs/graphlib@4.0.1': + resolution: {integrity: sha512-IvcV6FduIIAmLwnH+yun+QtV36SC7mERqa86aClNqmMN09WhmPPYU8ckHrZBozErf+UvHPWOTJYaGYiIcs0DgA==} + '@date-fns/tz@1.4.1': resolution: {integrity: sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA==} @@ -1704,6 +1769,12 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.28.0': + resolution: {integrity: sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + '@esbuild/android-arm64@0.17.19': resolution: {integrity: sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==} engines: {node: '>=12'} @@ -1740,6 +1811,12 @@ packages: cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.28.0': + resolution: {integrity: sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm@0.17.19': resolution: {integrity: sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==} engines: {node: '>=12'} @@ -1776,6 +1853,12 @@ packages: cpu: [arm] os: [android] + '@esbuild/android-arm@0.28.0': + resolution: {integrity: sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + '@esbuild/android-x64@0.17.19': resolution: {integrity: sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==} engines: {node: '>=12'} @@ -1812,6 +1895,12 @@ packages: cpu: [x64] os: [android] + '@esbuild/android-x64@0.28.0': + resolution: {integrity: sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + '@esbuild/darwin-arm64@0.17.19': resolution: {integrity: sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==} engines: {node: '>=12'} @@ -1848,6 +1937,12 @@ packages: cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.28.0': + resolution: {integrity: sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-x64@0.17.19': resolution: {integrity: sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==} engines: {node: '>=12'} @@ -1884,6 +1979,12 @@ packages: cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.28.0': + resolution: {integrity: sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + '@esbuild/freebsd-arm64@0.17.19': resolution: {integrity: sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==} engines: {node: '>=12'} @@ -1920,6 +2021,12 @@ packages: cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.28.0': + resolution: {integrity: sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-x64@0.17.19': resolution: {integrity: sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==} engines: {node: '>=12'} @@ -1956,6 +2063,12 @@ packages: cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.28.0': + resolution: {integrity: sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + '@esbuild/linux-arm64@0.17.19': resolution: {integrity: sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==} engines: {node: '>=12'} @@ -1992,6 +2105,12 @@ packages: cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.28.0': + resolution: {integrity: sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm@0.17.19': resolution: {integrity: sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==} engines: {node: '>=12'} @@ -2028,6 +2147,12 @@ packages: cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.28.0': + resolution: {integrity: sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + '@esbuild/linux-ia32@0.17.19': resolution: {integrity: sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==} engines: {node: '>=12'} @@ -2064,6 +2189,12 @@ packages: cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.28.0': + resolution: {integrity: sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-loong64@0.14.54': resolution: {integrity: sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw==} engines: {node: '>=12'} @@ -2106,6 +2237,12 @@ packages: cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.28.0': + resolution: {integrity: sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-mips64el@0.17.19': resolution: {integrity: sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==} engines: {node: '>=12'} @@ -2142,6 +2279,12 @@ packages: cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.28.0': + resolution: {integrity: sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-ppc64@0.17.19': resolution: {integrity: sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==} engines: {node: '>=12'} @@ -2178,6 +2321,12 @@ packages: cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.28.0': + resolution: {integrity: sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-riscv64@0.17.19': resolution: {integrity: sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==} engines: {node: '>=12'} @@ -2214,6 +2363,12 @@ packages: cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.28.0': + resolution: {integrity: sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-s390x@0.17.19': resolution: {integrity: sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==} engines: {node: '>=12'} @@ -2250,6 +2405,12 @@ packages: cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.28.0': + resolution: {integrity: sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-x64@0.17.19': resolution: {integrity: sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==} engines: {node: '>=12'} @@ -2286,6 +2447,12 @@ packages: cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.28.0': + resolution: {integrity: sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + '@esbuild/netbsd-arm64@0.25.10': resolution: {integrity: sha512-AKQM3gfYfSW8XRk8DdMCzaLUFB15dTrZfnX8WXQoOUpUBQ+NaAFCP1kPS/ykbbGYz7rxn0WS48/81l9hFl3u4A==} engines: {node: '>=18'} @@ -2298,6 +2465,12 @@ packages: cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-arm64@0.28.0': + resolution: {integrity: sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + '@esbuild/netbsd-x64@0.17.19': resolution: {integrity: sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==} engines: {node: '>=12'} @@ -2334,6 +2507,12 @@ packages: cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.28.0': + resolution: {integrity: sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + '@esbuild/openbsd-arm64@0.23.1': resolution: {integrity: sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==} engines: {node: '>=18'} @@ -2352,6 +2531,12 @@ packages: cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-arm64@0.28.0': + resolution: {integrity: sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + '@esbuild/openbsd-x64@0.17.19': resolution: {integrity: sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==} engines: {node: '>=12'} @@ -2388,6 +2573,12 @@ packages: cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.28.0': + resolution: {integrity: sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + '@esbuild/openharmony-arm64@0.25.10': resolution: {integrity: sha512-AVTSBhTX8Y/Fz6OmIVBip9tJzZEUcY8WLh7I59+upa5/GPhh2/aM6bvOMQySspnCCHvFi79kMtdJS1w0DXAeag==} engines: {node: '>=18'} @@ -2400,6 +2591,12 @@ packages: cpu: [arm64] os: [openharmony] + '@esbuild/openharmony-arm64@0.28.0': + resolution: {integrity: sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + '@esbuild/sunos-x64@0.17.19': resolution: {integrity: sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==} engines: {node: '>=12'} @@ -2436,6 +2633,12 @@ packages: cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.28.0': + resolution: {integrity: sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + '@esbuild/win32-arm64@0.17.19': resolution: {integrity: sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==} engines: {node: '>=12'} @@ -2472,6 +2675,12 @@ packages: cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.28.0': + resolution: {integrity: sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-ia32@0.17.19': resolution: {integrity: sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==} engines: {node: '>=12'} @@ -2508,6 +2717,12 @@ packages: cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.28.0': + resolution: {integrity: sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-x64@0.17.19': resolution: {integrity: sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==} engines: {node: '>=12'} @@ -2544,6 +2759,12 @@ packages: cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.28.0': + resolution: {integrity: sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3269,6 +3490,10 @@ packages: cpu: [x64] os: [win32] + '@noble/hashes@2.2.0': + resolution: {integrity: sha512-IYqDGiTXab6FniAgnSdZwgWbomxpy9FtYvLKs7wCUs2a8RkITG+DFGO1DM9cr+E3/RgADRpFjrKVaJ1z6sjtEg==} + engines: {node: '>= 20.19.0'} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -3438,14 +3663,6 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@planetscale/database@1.18.0': - resolution: {integrity: sha512-t2XdOfrVgcF7AW791FtdPS27NyNqcE1SpoXgk3HpziousvUMsJi4Q6NL3JyOBpsMOrvk94749o8yyonvX5quPw==} - engines: {node: '>=16'} - - '@planetscale/database@1.19.0': - resolution: {integrity: sha512-Tv4jcFUFAFjOWrGSio49H6R2ijALv0ZzVBfJKIdm+kl9X046Fh4LLawrF9OMsglVbK6ukqMJsUCeucGAFTBcMA==} - engines: {node: '>=16'} - '@playwright/test@1.58.2': resolution: {integrity: sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==} engines: {node: '>=18'} @@ -3466,8 +3683,142 @@ packages: '@polka/url@1.0.0-next.29': resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} - '@prisma/adapter-planetscale@6.19.1': - resolution: {integrity: sha512-5ooI/q9mzBUnomqqx6ADkaE706AukbliH3O8cWujGOYyH/uQbZhlNOMJX7oKLOz1nWEV3BvnxLI9qGK0+fg50Q==} + '@prisma-next/adapter-postgres@file:packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz': + resolution: {integrity: sha512-31TS4l905B9QPN28g6aqOqHPfPv3u08uZ01O6uRAu311DnYW4y8lgUKlHICei6wxtzW7A5FseWhP4iPlgxU0KQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/cli@file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz': + resolution: {integrity: sha512-LXYRIe9+kIcggpn5s4OccJRS8j0QBaAsT6NCVuMl9ZK4Ib3qJPrl9T3fNmGss+kAzk4LhXMKt3wQtviIexmItg==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz} + version: 0.0.1 + hasBin: true + + '@prisma-next/config@file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz': + resolution: {integrity: sha512-PgkEa94zV6ePkO1R+UGQ4zsx0RV2I4TSO9hhHgBtxDgd1vHnR82kSyI4N592z6YiG3S9JCIm8HuT/ub0VR594g==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/contract-authoring@file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz': + resolution: {integrity: sha512-X+F+z2DCzlgJatEpMbQtU8hhgvWVG/zAVid4w+Rj+ROBtmY0+fjSaN1VeYwsCihbvUIUJHC1wxowG+QOHDZ3wQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/contract@file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz': + resolution: {integrity: sha512-7iCTMth7W+uIOgxcm/pC1CBJ8xcNo08bw+TxFZcHShyHmoZ6Vp3HTwBwhfBMWxtQ2/36G6xO/GNJwn4RjqXN3Q==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/driver-postgres@file:packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz': + resolution: {integrity: sha512-XgcBXIxhuuJWlXUYjIbgWz43csNrlL6E8w01DHtlEf1PPfk55VmjL4KTDs5YOQ2GdTEErnRvJq9Z8Zmaof6WmA==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/emitter@file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz': + resolution: {integrity: sha512-kDC5v12Mh6Z4WSbEvPSIqBuXqjpB9O8vMKmZ9AgRNc1Q3IKwqvCuIoVMZarcSqtRuo27LDsu+e0B2EVM8mlT/Q==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/errors@file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz': + resolution: {integrity: sha512-+P+9BYjthIrOBmd5zimNknkl/+BDCysViRzQ232p5k42tRkE6ft+FZP/zWKT4f1iqQnsNQki8bbpIgQny3p90A==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/family-sql@file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz': + resolution: {integrity: sha512-vOgjkyqzgQe/dcMm48/cciNDs6HMnKJvelvkhSZLJtR8ql12tTUhQ55rrVk5Vwc8HPuT70pNdKPRU9kqIvUEZA==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/framework-components@file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz': + resolution: {integrity: sha512-qy8llXPNZCqbik4CAJCyPLXWz6uIo15SljvoiHPjQYUMZGNVdpMhJV2NP78FX/2EBILiwdphjjk6DzQc2kYG9g==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/ids@file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz': + resolution: {integrity: sha512-w5SD4glK/J6CQ6Mgvl1XzisbZbgnjq/IEW7aE78bAUbmJMn17h7AiB+7JPFp6yFUVyE2RT0BZXHf3aIbM7oVnw==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/migration-tools@file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz': + resolution: {integrity: sha512-tteAZa2pZghfqzofzkhgSmIIybmU6yktCdeeCZE3Z7HIaR5YTKlIkBKp2nkkEpNw+m8RJmxyiv+PG5BieokscA==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/operations@file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz': + resolution: {integrity: sha512-cp/A+YasN24U3FiwjlB7SbqknPS99ZyQjYn9xuefZ8UqcObupQiOrPcRgHkXYfifh1c0rQst+zbbMxTi12mFYA==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/postgres@file:packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz': + resolution: {integrity: sha512-h0Zis4WDV+3cI8l7dB72Ltq+QybE/DvZ7WZEpGJUuM3LDzbvjvr0diCBPFPlRjakYbsfgH+RLpElQp0pNdjWdQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/psl-parser@file:packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz': + resolution: {integrity: sha512-slmf6O0dSx7xxwIPLl1vfN65t9FtFAuGvY9jF68M4TsPXQh8r6NC6ffNo4L4Qg3y7lRpaduuFyKsYDdVK4DUDw==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/psl-printer@file:packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz': + resolution: {integrity: sha512-GtkRBQJAqUvu4m9kPNGY3l3bwY+tNrFv+RaBVAy7pri9AUvI6KcQBcwrFQLtrmPxgvqUH4E5JTsl42I6mujYuQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-builder@file:packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz': + resolution: {integrity: sha512-evpKldnsMNCAwBRZLbq3BK5V5vElqe8Z0Az4+jELS32+zQ2zv1GTVH1qnspxj+x8dta4eGWJkcIW5U0cjsYsew==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/sql-contract-emitter@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz': + resolution: {integrity: sha512-0uK9PM1BwcDSGO817Im+lTE1ONefM3dUHGw5YsAAk40vBV82FjRHEKMunIBMGJr28jQwLlB+DHWtwkyYyqL92w==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-contract-psl@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz': + resolution: {integrity: sha512-B0S6h4M1ib4w2VepFEKTyyOiw54TCmXqnuH5fExt0+7vR9Um9v5vHFzcXOX2oK6oNFWpwM/IwX1mDYd/f3N+kg==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-contract-ts@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz': + resolution: {integrity: sha512-Rlx4t5n672Rc4oMoM0u5a6KzindcXtOGxP35tyluNU9vo2rqSXLZejboPuCnVKAwYqtA282DYt0i2N65NLtNUw==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-contract@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz': + resolution: {integrity: sha512-FlADWZxMMNX5EiEDioujPWXBlcDU93f9HQznWM7mMo/CM/1clOlnT4XsTaX+Hm7rp4lWcmwTUIUDTmjWyjrSbQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-errors@file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz': + resolution: {integrity: sha512-+T+PaXsxejVvROTJo+U9ZtgLIKOZXfq/rYjV1weq6AmtNC0f2DNyCvl4RCmp/+mcTKqiE/H+rnlBkCqYp3uyQg==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/sql-operations@file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz': + resolution: {integrity: sha512-zdyUx6ziYhSXwwkBGzw51KAFRGfjzHxB3zKc0XN6eZrMpl8Nk2+n2MlUqaIuAzB2WuXuaWVk5kVbskVrAxmalQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/sql-orm-client@file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz': + resolution: {integrity: sha512-zjKHZ0fPbXjOYA151Q2RxIvtsTdQ9mNoQv04VuSEtdWkAFYJy5fCxALwBfOS0u39nMR5pVP3aPynAdk1UD3x0w==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/sql-relational-core@file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz': + resolution: {integrity: sha512-O3sY50O1sh59Xq7a+W1yZQ2v0i1rxtgfiT0JgjRfDYFSOSlatOLkcXJRXrVdDkq6BxTCb/tQF++JiszPkks16w==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-runtime@file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz': + resolution: {integrity: sha512-bcLcKZtxBoVvpY4zArpvWP3JbzELcC9AjVhK09HEGaCY2rbh+nvltzAh2hZ2Psc9lELUIB744s5+8niJVUEaAw==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/sql-schema-ir@file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz': + resolution: {integrity: sha512-rq6nSoV1WiOLjChqHbwk8ZeiTEeaF1/ujwSDEA6MC23Uze85yOJdNYyfaWQ1FU0bcDd4zuDOfx2/V4uiBBILWQ==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/target-postgres@file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz': + resolution: {integrity: sha512-edIrt/BErXjHEQC0l5eZZ+qlgUgCbl5M4nmjB/cHaKSzfvVGIEtDELti/4xnwW30BFpF4VmGIZ5TsEySFR/7zw==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz} + version: 0.0.1 + + '@prisma-next/ts-render@file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz': + resolution: {integrity: sha512-NN/ip26cGpReLDsa2zXgXAauRccgS6FIgEC6QxYIlZRMhit2TGlSDtZODy5mlNSng34Eoy+5Bn7juKBe2H8+dw==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma-next/utils@file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz': + resolution: {integrity: sha512-AzyngTLbbg6NIholgeImdWzWFHfXO9hYmaWA05EWb2I/7B8im3wlxqUjAAdWJjEW1XpKoz9IWVaKQ6SFjggG+g==, tarball: file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz} + version: 0.0.1 + engines: {node: '>=20'} + + '@prisma/adapter-pg@6.19.1': + resolution: {integrity: sha512-ty/DXF+DVU7AeawWKPMsmdWnzqovU3Pfex3rpG7HFnCQb7TKErAsh7SHMVeNCj9rl64cQgqjqD6OU5622XDQzA==} '@prisma/client@6.19.1': resolution: {integrity: sha512-4SXj4Oo6HyQkLUWT8Ke5R0PTAfVOKip5Roo+6+b2EDTkFg5be0FnBWiuRJc0BC0sRQIWGMLKW1XguhVfW/z3/A==} @@ -4344,99 +4695,116 @@ packages: '@react-email/body@0.2.1': resolution: {integrity: sha512-ljDiQiJDu/Fq//vSIIP0z5Nuvt4+DX1RqGasstChDGJB/14ogd4VdNS9aacoede/ZjGy3o3Qb+cxyS+XgM6SwQ==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/button@0.2.1': resolution: {integrity: sha512-qXyj7RZLE7POy9BMKSoqQ00tOXThjOZSUnI2Yu9i29IHngPlmrNayIWBoVKtElES7OWwypUcpiajwi1mUWx6/A==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/code-block@0.2.1': resolution: {integrity: sha512-M3B7JpVH4ytgn83/ujRR1k1DQHvTeABiDM61OvAbjLRPhC/5KLHU5KkzIbbuGIrjWwxAbL1kSQzU8MhLEtSxyw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/code-inline@0.0.6': resolution: {integrity: sha512-jfhebvv3dVsp3OdPgKXnk8+e2pBiDVZejDOBFzBa/IblrAJ9cQDkN6rBD5IyEg8hTOxwbw3iaI/yZFmDmIguIA==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/column@0.0.14': resolution: {integrity: sha512-f+W+Bk2AjNO77zynE33rHuQhyqVICx4RYtGX9NKsGUg0wWjdGP0qAuIkhx9Rnmk4/hFMo1fUrtYNqca9fwJdHg==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/components@1.0.8': resolution: {integrity: sha512-zY81ED6o5MWMzBkr9uZFuT24lWarT+xIbOZxI6C9dsFmCWBczM8IE1BgOI8rhpUK4JcYVDy1uKxYAFqsx2Bc4w==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/container@0.0.16': resolution: {integrity: sha512-QWBB56RkkU0AJ9h+qy33gfT5iuZknPC7Un/IjZv9B0QmMIK+WWacc0cH6y2SV5Cv/b99hU94fjEMOOO4enpkbQ==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/font@0.0.10': resolution: {integrity: sha512-0urVSgCmQIfx5r7Xc586miBnQUVnGp3OTYUm8m5pwtQRdTRO5XrTtEfNJ3JhYhSOruV0nD8fd+dXtKXobum6tA==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/head@0.0.13': resolution: {integrity: sha512-AJg6le/08Gz4tm+6MtKXqtNNyKHzmooOCdmtqmWxD7FxoAdU1eVcizhtQ0gcnVaY6ethEyE/hnEzQxt1zu5Kog==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/heading@0.0.16': resolution: {integrity: sha512-jmsKnQm1ykpBzw4hCYHwBkt5pW2jScXffPeEH5ZRF5tZeF5b1pvlFTO9han7C0pCkZYo1kEvWiRtx69yfCIwuw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/hr@0.0.12': resolution: {integrity: sha512-TwmOmBDibavUQpXBxpmZYi2Iks/yeZOzFYh+di9EltMSnEabH8dMZXrl+pxNXzCgZ2XE8HY7VmUL65Lenfu5PA==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/html@0.0.12': resolution: {integrity: sha512-KTShZesan+UsreU7PDUV90afrZwU5TLwYlALuCSU0OT+/U8lULNNbAUekg+tGwCnOfIKYtpDPKkAMRdYlqUznw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/img@0.0.12': resolution: {integrity: sha512-sRCpEARNVTf3FQhZOC+JTvu5r6ubiYWkT0ucYXg8ctkyi4G8QG+jgYPiNUqVeTLA2STOfmPM/nrk1nb84y6CPQ==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/link@0.0.13': resolution: {integrity: sha512-lkWc/NjOcefRZMkQoSDDbuKBEBDES9aXnFEOuPH845wD3TxPwh+QTf0fStuzjoRLUZWpHnio4z7qGGRYusn/sw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/markdown@0.0.18': resolution: {integrity: sha512-gSuYK5fsMbGk87jDebqQ6fa2fKcWlkf2Dkva8kMONqLgGCq8/0d+ZQYMEJsdidIeBo3kmsnHZPrwdFB4HgjUXg==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/preview-server@5.2.8': resolution: {integrity: sha512-drQ0C7vi7P0uE7Ox1Cyiujsx0oqp2RbIscOdSBR5qvzw3EKjlGbW2pWjQ000cjxTq3Si7lqlRKhOIF8MzOnqHw==} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. '@react-email/preview@0.0.14': resolution: {integrity: sha512-aYK8q0IPkBXyMsbpMXgxazwHxYJxTrXrV95GFuu2HbEiIToMwSyUgb8HDFYwPqqfV03/jbwqlsXmFxsOd+VNaw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc @@ -4450,18 +4818,21 @@ packages: '@react-email/row@0.0.13': resolution: {integrity: sha512-bYnOac40vIKCId7IkwuLAAsa3fKfSfqCvv6epJKmPE0JBuu5qI4FHFCl9o9dVpIIS08s/ub+Y/txoMt0dYziGw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/section@0.0.17': resolution: {integrity: sha512-qNl65ye3W0Rd5udhdORzTV9ezjb+GFqQQSae03NDzXtmJq6sqVXNWNiVolAjvJNypim+zGXmv6J9TcV5aNtE/w==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc '@react-email/tailwind@2.0.5': resolution: {integrity: sha512-7Ey+kiWliJdxPMCLYsdDts8ffp4idlP//w4Ui3q/A5kokVaLSNKG8DOg/8qAuzWmRiGwNQVOKBk7PXNlK5W+sg==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: '@react-email/body': 0.2.1 '@react-email/button': 0.2.1 @@ -4500,6 +4871,7 @@ packages: '@react-email/text@0.1.6': resolution: {integrity: sha512-TYqkioRS45wTR5il3dYk/SbUjjEdhSwh9BtRNB99qNH1pXAwA45H7rAuxehiu8iJQJH0IyIr+6n62gBz9ezmsw==} engines: {node: '>=20.0.0'} + deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. peerDependencies: react: ^18.0 || ^19.0 || ^19.0.0-rc @@ -5455,6 +5827,7 @@ packages: '@team-plain/typescript-sdk@5.9.0': resolution: {integrity: sha512-AHSXyt1kDt74m9YKZBCRCd6cQjB8QjUNr9cehtR2QHzZ/8yXJPzawPJDqOQ3ms5KvwuYrBx2qT3e6C/zrQ5UtA==} + deprecated: This package is now deprecated. Please use @team-plain/graphql, @team-plain/webhooks and @team-plain/ui-components (https://github.com/team-plain/sdk) '@tediousjs/connection-string@0.5.0': resolution: {integrity: sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ==} @@ -5889,6 +6262,9 @@ packages: '@types/parse-json@4.0.2': resolution: {integrity: sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==} + '@types/pg@8.11.11': + resolution: {integrity: sha512-kGT1qKM8wJQ5qlawUrEkXgvMSXoV213KfMGXcwfDwUIfUHXqXYXOfS1nE1LINRJVVVx5wCm70XnFlMHaIcQAfw==} + '@types/prettier@2.7.3': resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==} @@ -6260,10 +6636,12 @@ packages: '@xmldom/xmldom@0.8.10': resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==} engines: {node: '>=10.0.0'} + deprecated: this version has critical issues, please update to the latest version '@xmldom/xmldom@0.9.8': resolution: {integrity: sha512-p96FSY54r+WJ50FIOsCOjyj/wavs8921hG5+kVMmZgKcvIKxMXHTrjNJvRgWa/zuX3B6t2lijLNFaOyuxUH+2A==} engines: {node: '>=14.6'} + deprecated: this version has critical issues, please update to the latest version abab@2.0.6: resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} @@ -6407,6 +6785,10 @@ packages: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} + ansi-regex@6.2.2: + resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} + engines: {node: '>=12'} + ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} @@ -6423,6 +6805,10 @@ packages: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + ansi-styles@6.2.3: + resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} + engines: {node: '>=12'} + ansi-to-html@0.7.2: resolution: {integrity: sha512-v6MqmEpNlxF+POuyhKkidusCHWWkaLcGRURzivcU3I9tv7k4JVhFcnukrM5Rlk2rUywdZuzYAZ+kbZqWCnfN3g==} engines: {node: '>=8.0.0'} @@ -6482,6 +6868,12 @@ packages: resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} engines: {node: '>= 0.4'} + arkregex@0.0.5: + resolution: {integrity: sha512-ncYjBdLlh5/QnVsAA8De16Tc9EqmYM7y/WU9j+236KcyYNUXogpz3sC4ATIZYzzLxwI+0sEOaQLEmLmRleaEXw==} + + arktype@2.2.0: + resolution: {integrity: sha512-t54MZ7ti5BhOEvzEkgKnWvqj+UbDfWig+DHr5I34xatymPusKLS0lQpNJd8M6DzmIto2QGszHfNKoFIT8tMCZQ==} + array-buffer-byte-length@1.0.0: resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} @@ -6545,9 +6937,6 @@ packages: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} engines: {node: '>=8'} - async-mutex@0.5.0: - resolution: {integrity: sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==} - async@3.2.6: resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} @@ -6837,6 +7226,14 @@ packages: magicast: optional: true + c12@3.3.4: + resolution: {integrity: sha512-cM0ApFQSBXuourJejzwv/AuPRvAxordTyParRVcHjjtXirtkzM0uK2L9TTn9s0cXZbG7E55jCivRQzoxYmRAlA==} + peerDependencies: + magicast: '*' + peerDependenciesMeta: + magicast: + optional: true + cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -6969,6 +7366,10 @@ packages: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} + chokidar@5.0.0: + resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==} + engines: {node: '>= 20.19.0'} + chownr@1.1.4: resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} @@ -7043,6 +7444,11 @@ packages: client-only@0.0.1: resolution: {integrity: sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==} + clipanion@4.0.0-rc.4: + resolution: {integrity: sha512-CXkMQxU6s9GklO/1f714dkKBMu1lopS1WFF0B8o4AxPykR1hpozxSiUZ5ZUeBjfPgCWqbcNOtZVFhB8Lkfp1+Q==} + peerDependencies: + typanion: '*' + cliui@7.0.4: resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} @@ -7058,6 +7464,9 @@ packages: resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==} engines: {node: '>=0.8'} + closest-match@1.3.3: + resolution: {integrity: sha512-RSdHrZwNOvt2uMQgqJDJdM/I+5MlJ1tQJEXYrbRjSMXWiCRo06g2hwObJ7+WKt2J9ySK9/pJ0Q2vbL+BPkofDA==} + clsx@2.0.0: resolution: {integrity: sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==} engines: {node: '>=6'} @@ -7107,6 +7516,9 @@ packages: resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} hasBin: true + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -7122,6 +7534,10 @@ packages: resolution: {integrity: sha512-oPYleIY8wmTVzkvQq10AEok6YcTC4sRUBl8F9gVuwchGVUCTbl/vhLTaQqutuuySYOsu8YTgV+OxKc/8Yvx+mQ==} engines: {node: '>=18'} + commander@14.0.3: + resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} + engines: {node: '>=20'} + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -7148,6 +7564,9 @@ packages: confbox@0.2.2: resolution: {integrity: sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==} + confbox@0.2.4: + resolution: {integrity: sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==} + config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} @@ -7545,6 +7964,9 @@ packages: defu@6.1.4: resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + defu@6.1.7: + resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==} + delaunator@5.0.0: resolution: {integrity: sha512-AyLvtyJdbv/U1GkiS6gUUzclRoAY4Gs75qkMygJJhU75LW4DNuSF2RMzpxs9jw9Oz1BobHjTdkG3zdP55VxAqw==} @@ -7710,6 +8132,10 @@ packages: resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==} engines: {node: '>=12'} + dotenv@17.4.2: + resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==} + engines: {node: '>=12'} + dotenv@8.6.0: resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} engines: {node: '>=10'} @@ -8055,6 +8481,11 @@ packages: engines: {node: '>=18'} hasBin: true + esbuild@0.28.0: + resolution: {integrity: sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==} + engines: {node: '>=18'} + hasBin: true + escalade@3.1.2: resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} engines: {node: '>=6'} @@ -8284,9 +8715,18 @@ packages: fast-sha256@1.3.0: resolution: {integrity: sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==} + fast-string-truncated-width@3.0.3: + resolution: {integrity: sha512-0jjjIEL6+0jag3l2XWWizO64/aZVtpiGE3t0Zgqxv0DPuxiMjvB3M24fCyhZUO4KomJQPj3LTSUnDP3GpdwC0g==} + + fast-string-width@3.0.2: + resolution: {integrity: sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg==} + fast-uri@3.1.0: resolution: {integrity: sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==} + fast-wrap-ansi@0.2.0: + resolution: {integrity: sha512-rLV8JHxTyhVmFYhBJuMujcrHqOT2cnO5Zxj37qROj23CP39GXubJRBUFF0z8KFK77Uc0SukZUf7JZhsVEQ6n8w==} + fast-xml-parser@4.4.1: resolution: {integrity: sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==} hasBin: true @@ -8574,6 +9014,10 @@ packages: resolution: {integrity: sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==} engines: {node: '>=18'} + get-east-asian-width@1.5.0: + resolution: {integrity: sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==} + engines: {node: '>=18'} + get-intrinsic@1.2.4: resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} engines: {node: '>= 0.4'} @@ -8620,6 +9064,10 @@ packages: resolution: {integrity: sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==} hasBin: true + giget@3.2.0: + resolution: {integrity: sha512-GvHTWcykIR/fP8cj8dMpuMMkvaeJfPvYnhq0oW+chSeIr+ldX21ifU2Ms6KBoyKZQZmVaUAAhQ2EZ68KJF8a7A==} + hasBin: true + github-from-package@0.0.0: resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} @@ -9676,6 +10124,9 @@ packages: engines: {node: '>=6'} hasBin: true + jsonc-parser@3.3.1: + resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} + jsondiffpatch@0.6.0: resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -10638,6 +11089,9 @@ packages: obliterator@1.6.1: resolution: {integrity: sha512-9WXswnqINnnhOG/5SLimUlzuU1hFJUc8zkwyD59Sd+dPOMf05PmnYG/d6Q7HZ+KmgkZJa1PxRso6QdM3sTNHig==} + obuf@1.1.2: + resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} + ohash@2.0.11: resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==} @@ -10773,6 +11227,9 @@ packages: resolution: {integrity: sha512-cbH9IAIJHNj9uXi196JVsRlt7cHKak6u/e6AkL/bkRelZ7rlL3X1YKxsZwa36xipOEKAsdtmaG6aAJoM1fx2zA==} engines: {node: '>=14.16'} + package-manager-detector@1.6.0: + resolution: {integrity: sha512-61A5ThoTiDG/C8s8UMZwSorAGwMJ0ERVGj2OjoW5pAalsNOg15+iQiPzrLJ4jhZ1HJzmC2PIHT2oEiH3R5fzNA==} + pako@0.2.9: resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==} @@ -10883,31 +11340,61 @@ packages: perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + perfect-debounce@2.1.0: + resolution: {integrity: sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g==} + performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} pg-cloudflare@1.2.5: resolution: {integrity: sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==} + pg-cloudflare@1.3.0: + resolution: {integrity: sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==} + + pg-connection-string@2.12.0: + resolution: {integrity: sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==} + pg-connection-string@2.9.1: resolution: {integrity: sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==} + pg-cursor@2.19.0: + resolution: {integrity: sha512-J5cF1MUz7LRJ9emOqF/06QjabMHMZy587rSPF0UuA8rCwKeeYl2co8Pp+6k5UU9YrAYHMzWkLxilfZB0hqsWWw==} + peerDependencies: + pg: ^8 + pg-int8@1.0.1: resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} engines: {node: '>=4.0.0'} + pg-numeric@1.0.2: + resolution: {integrity: sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==} + engines: {node: '>=4'} + pg-pool@3.10.1: resolution: {integrity: sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==} peerDependencies: pg: '>=8.0' + pg-pool@3.13.0: + resolution: {integrity: sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==} + peerDependencies: + pg: '>=8.0' + pg-protocol@1.10.3: resolution: {integrity: sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==} + pg-protocol@1.13.0: + resolution: {integrity: sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==} + pg-types@2.2.0: resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} engines: {node: '>=4'} + pg-types@4.1.0: + resolution: {integrity: sha512-o2XFanIMy/3+mThw69O8d4n1E5zsLhdO+OPqswezu7Z5ekP4hYDqlDjlmOpYMbzY2Br0ufCwJLdDIXeNVwcWFg==} + engines: {node: '>=10'} + pg@8.16.0: resolution: {integrity: sha512-7SKfdvP8CTNXjMUzfcVTaI+TDzBEeaUnVwiVGZQD1Hh33Kpev7liQba9uLd4CfN8r9mCVsD0JIpq03+Unpz+kg==} engines: {node: '>= 8.0.0'} @@ -10917,6 +11404,15 @@ packages: pg-native: optional: true + pg@8.20.0: + resolution: {integrity: sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==} + engines: {node: '>= 16.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + pgpass@1.0.5: resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} @@ -11047,18 +11543,37 @@ packages: resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} engines: {node: '>=4'} + postgres-array@3.0.4: + resolution: {integrity: sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ==} + engines: {node: '>=12'} + postgres-bytea@1.0.0: resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} engines: {node: '>=0.10.0'} + postgres-bytea@3.0.0: + resolution: {integrity: sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==} + engines: {node: '>= 6'} + postgres-date@1.0.7: resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} engines: {node: '>=0.10.0'} + postgres-date@2.1.0: + resolution: {integrity: sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==} + engines: {node: '>=12'} + postgres-interval@1.2.0: resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} engines: {node: '>=0.10.0'} + postgres-interval@3.0.0: + resolution: {integrity: sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==} + engines: {node: '>=12'} + + postgres-range@1.1.4: + resolution: {integrity: sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==} + preact-render-to-string@5.2.6: resolution: {integrity: sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==} peerDependencies: @@ -11070,6 +11585,7 @@ packages: prebuild-install@7.1.3: resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. hasBin: true prelude-ls@1.2.1: @@ -11156,6 +11672,11 @@ packages: engines: {node: '>=14'} hasBin: true + prettier@3.8.3: + resolution: {integrity: sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==} + engines: {node: '>=14'} + hasBin: true + pretty-format@26.6.2: resolution: {integrity: sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==} engines: {node: '>= 10'} @@ -11370,6 +11891,9 @@ packages: rc9@2.1.2: resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==} + rc9@3.0.1: + resolution: {integrity: sha512-gMDyleLWVE+i6Sgtc0QbbY6pEKqYs97NGi6isHQPqYlLemPoO8dxQ3uGi0f4NiP98c+jMW6cG1Kx9dDwfvqARQ==} + rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true @@ -11549,6 +12073,10 @@ packages: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} + readdirp@5.0.0: + resolution: {integrity: sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==} + engines: {node: '>= 20.19.0'} + recast@0.23.11: resolution: {integrity: sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==} engines: {node: '>= 4'} @@ -12164,6 +12692,10 @@ packages: resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} engines: {node: '>=18'} + string-width@8.2.1: + resolution: {integrity: sha512-IIaP0g3iy9Cyy18w3M9YcaDudujEAVHKt3a3QJg1+sr/oX96TbaGUubG0hJyCjCBThFH+tFpcIyoUHUn1ogaLA==} + engines: {node: '>=20'} + string.prototype.codepointat@0.2.1: resolution: {integrity: sha512-2cBVCj6I4IOvEnjgO/hWqXjqBGsY+zwPmHl12Srk9IXSZ56Jwwmy+66XO5Iut/oQVR7t5ihYdLB0GMa4alEUcg==} @@ -12209,6 +12741,10 @@ packages: resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} engines: {node: '>=12'} + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + strip-bom@3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} @@ -12622,6 +13158,9 @@ packages: '@swc/wasm': optional: true + ts-toolbelt@9.6.0: + resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==} + tsconfck@3.0.3: resolution: {integrity: sha512-4t0noZX9t6GcPTfBAbIbbIU4pfpCwh0ueq3S4O/5qXI1VwK1outmxhe9dOiEWqMz3MW2LKgDTpqWV+37IWuVbA==} engines: {node: ^18 || >=20} @@ -12770,6 +13309,9 @@ packages: tweetnacl@0.14.5: resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==} + typanion@3.14.0: + resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -12969,6 +13511,10 @@ packages: unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} + uniku@0.0.12: + resolution: {integrity: sha512-wqt0D/ZcBTDprQxlFpxDm4jCHlQyHWQ62PMXPF0AfU7oxHm4g5++7EY7/+uwApCMOhfzRE8fTf4WATe6lH1vkg==} + engines: {node: '>=24.13.0'} + unique-filename@1.1.1: resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} @@ -13486,6 +14032,10 @@ packages: resolution: {integrity: sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==} engines: {node: '>=18'} + wrap-ansi@10.0.0: + resolution: {integrity: sha512-SGcvg80f0wUy2/fXES19feHMz8E0JoXv2uNgHOu4Dgi2OrCy1lqwFYEJz1BLbDI0exjPMe/ZdzZ/YpGECBG/aQ==} + engines: {node: '>=20'} + wrap-ansi@6.2.0: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} @@ -13798,6 +14348,12 @@ snapshots: '@antfu/utils@0.7.10': optional: true + '@ark/schema@0.56.0': + dependencies: + '@ark/util': 0.56.0 + + '@ark/util@0.56.0': {} + '@asamuzakjp/css-color@3.2.0': dependencies: '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) @@ -14611,9 +15167,9 @@ snapshots: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.25.9 - '@babel/plugin-syntax-jsx@7.27.1(@babel/core@7.24.5)': + '@babel/plugin-syntax-jsx@7.27.1(@babel/core@7.28.4)': dependencies: - '@babel/core': 7.24.5 + '@babel/core': 7.28.4 '@babel/helper-plugin-utils': 7.27.1 optional: true @@ -14808,6 +15364,18 @@ snapshots: dependencies: zod: 4.3.5 + '@clack/core@1.3.0': + dependencies: + fast-wrap-ansi: 0.2.0 + sisteransi: 1.0.5 + + '@clack/prompts@1.3.0': + dependencies: + '@clack/core': 1.3.0 + fast-string-width: 3.0.2 + fast-wrap-ansi: 0.2.0 + sisteransi: 1.0.5 + '@cspotcode/source-map-support@0.8.1': dependencies: '@jridgewell/trace-mapping': 0.3.9 @@ -14840,6 +15408,12 @@ snapshots: '@csstools/css-tokenizer@3.0.4': optional: true + '@dagrejs/dagre@3.0.0': + dependencies: + '@dagrejs/graphlib': 4.0.1 + + '@dagrejs/graphlib@4.0.1': {} + '@date-fns/tz@1.4.1': {} '@dmsnell/diff-match-patch@1.1.0': {} @@ -14883,6 +15457,9 @@ snapshots: '@esbuild/aix-ppc64@0.25.12': optional: true + '@esbuild/aix-ppc64@0.28.0': + optional: true + '@esbuild/android-arm64@0.17.19': optional: true @@ -14901,6 +15478,9 @@ snapshots: '@esbuild/android-arm64@0.25.12': optional: true + '@esbuild/android-arm64@0.28.0': + optional: true + '@esbuild/android-arm@0.17.19': optional: true @@ -14919,6 +15499,9 @@ snapshots: '@esbuild/android-arm@0.25.12': optional: true + '@esbuild/android-arm@0.28.0': + optional: true + '@esbuild/android-x64@0.17.19': optional: true @@ -14937,6 +15520,9 @@ snapshots: '@esbuild/android-x64@0.25.12': optional: true + '@esbuild/android-x64@0.28.0': + optional: true + '@esbuild/darwin-arm64@0.17.19': optional: true @@ -14955,6 +15541,9 @@ snapshots: '@esbuild/darwin-arm64@0.25.12': optional: true + '@esbuild/darwin-arm64@0.28.0': + optional: true + '@esbuild/darwin-x64@0.17.19': optional: true @@ -14973,6 +15562,9 @@ snapshots: '@esbuild/darwin-x64@0.25.12': optional: true + '@esbuild/darwin-x64@0.28.0': + optional: true + '@esbuild/freebsd-arm64@0.17.19': optional: true @@ -14991,6 +15583,9 @@ snapshots: '@esbuild/freebsd-arm64@0.25.12': optional: true + '@esbuild/freebsd-arm64@0.28.0': + optional: true + '@esbuild/freebsd-x64@0.17.19': optional: true @@ -15009,6 +15604,9 @@ snapshots: '@esbuild/freebsd-x64@0.25.12': optional: true + '@esbuild/freebsd-x64@0.28.0': + optional: true + '@esbuild/linux-arm64@0.17.19': optional: true @@ -15027,6 +15625,9 @@ snapshots: '@esbuild/linux-arm64@0.25.12': optional: true + '@esbuild/linux-arm64@0.28.0': + optional: true + '@esbuild/linux-arm@0.17.19': optional: true @@ -15045,6 +15646,9 @@ snapshots: '@esbuild/linux-arm@0.25.12': optional: true + '@esbuild/linux-arm@0.28.0': + optional: true + '@esbuild/linux-ia32@0.17.19': optional: true @@ -15063,6 +15667,9 @@ snapshots: '@esbuild/linux-ia32@0.25.12': optional: true + '@esbuild/linux-ia32@0.28.0': + optional: true + '@esbuild/linux-loong64@0.14.54': optional: true @@ -15084,6 +15691,9 @@ snapshots: '@esbuild/linux-loong64@0.25.12': optional: true + '@esbuild/linux-loong64@0.28.0': + optional: true + '@esbuild/linux-mips64el@0.17.19': optional: true @@ -15102,6 +15712,9 @@ snapshots: '@esbuild/linux-mips64el@0.25.12': optional: true + '@esbuild/linux-mips64el@0.28.0': + optional: true + '@esbuild/linux-ppc64@0.17.19': optional: true @@ -15120,6 +15733,9 @@ snapshots: '@esbuild/linux-ppc64@0.25.12': optional: true + '@esbuild/linux-ppc64@0.28.0': + optional: true + '@esbuild/linux-riscv64@0.17.19': optional: true @@ -15138,6 +15754,9 @@ snapshots: '@esbuild/linux-riscv64@0.25.12': optional: true + '@esbuild/linux-riscv64@0.28.0': + optional: true + '@esbuild/linux-s390x@0.17.19': optional: true @@ -15156,6 +15775,9 @@ snapshots: '@esbuild/linux-s390x@0.25.12': optional: true + '@esbuild/linux-s390x@0.28.0': + optional: true + '@esbuild/linux-x64@0.17.19': optional: true @@ -15174,12 +15796,18 @@ snapshots: '@esbuild/linux-x64@0.25.12': optional: true + '@esbuild/linux-x64@0.28.0': + optional: true + '@esbuild/netbsd-arm64@0.25.10': optional: true '@esbuild/netbsd-arm64@0.25.12': optional: true + '@esbuild/netbsd-arm64@0.28.0': + optional: true + '@esbuild/netbsd-x64@0.17.19': optional: true @@ -15198,6 +15826,9 @@ snapshots: '@esbuild/netbsd-x64@0.25.12': optional: true + '@esbuild/netbsd-x64@0.28.0': + optional: true + '@esbuild/openbsd-arm64@0.23.1': optional: true @@ -15207,6 +15838,9 @@ snapshots: '@esbuild/openbsd-arm64@0.25.12': optional: true + '@esbuild/openbsd-arm64@0.28.0': + optional: true + '@esbuild/openbsd-x64@0.17.19': optional: true @@ -15225,12 +15859,18 @@ snapshots: '@esbuild/openbsd-x64@0.25.12': optional: true + '@esbuild/openbsd-x64@0.28.0': + optional: true + '@esbuild/openharmony-arm64@0.25.10': optional: true '@esbuild/openharmony-arm64@0.25.12': optional: true + '@esbuild/openharmony-arm64@0.28.0': + optional: true + '@esbuild/sunos-x64@0.17.19': optional: true @@ -15249,6 +15889,9 @@ snapshots: '@esbuild/sunos-x64@0.25.12': optional: true + '@esbuild/sunos-x64@0.28.0': + optional: true + '@esbuild/win32-arm64@0.17.19': optional: true @@ -15267,6 +15910,9 @@ snapshots: '@esbuild/win32-arm64@0.25.12': optional: true + '@esbuild/win32-arm64@0.28.0': + optional: true + '@esbuild/win32-ia32@0.17.19': optional: true @@ -15285,6 +15931,9 @@ snapshots: '@esbuild/win32-ia32@0.25.12': optional: true + '@esbuild/win32-ia32@0.28.0': + optional: true + '@esbuild/win32-x64@0.17.19': optional: true @@ -15303,6 +15952,9 @@ snapshots: '@esbuild/win32-x64@0.25.12': optional: true + '@esbuild/win32-x64@0.28.0': + optional: true + '@eslint-community/eslint-utils@4.4.0(eslint@8.48.0)': dependencies: eslint: 8.48.0 @@ -15443,7 +16095,7 @@ snapshots: - encoding - supports-color - '@hubspot/cli@7.6.2(@babel/core@7.24.5)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.6.2)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0)(typescript@5.6.2)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0))': + '@hubspot/cli@7.6.2(@babel/core@7.28.4)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.8.3)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0)(typescript@5.6.2)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0))': dependencies: '@hubspot/local-dev-lib': 3.19.1 '@hubspot/project-parsing-lib': 0.8.6(@hubspot/local-dev-lib@3.19.1) @@ -15474,7 +16126,7 @@ snapshots: yargs: 17.7.2 yargs-parser: 21.1.1 optionalDependencies: - '@hubspot/cms-dev-server': 1.0.38(@babel/core@7.24.5)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.6.2)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0) + '@hubspot/cms-dev-server': 1.0.38(@babel/core@7.28.4)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.8.3)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0) '@modelcontextprotocol/sdk': 1.13.3 transitivePeerDependencies: - '@babel/core' @@ -15512,7 +16164,7 @@ snapshots: react-dom: 18.3.1(react@18.3.1) optional: true - '@hubspot/cms-dev-server@1.0.38(@babel/core@7.24.5)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.6.2)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0)': + '@hubspot/cms-dev-server@1.0.38(@babel/core@7.28.4)(@types/node@18.11.9)(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(encoding@0.1.13)(prettier@3.8.3)(rollup@4.52.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(terser@5.27.0)': dependencies: '@babel/code-frame': 7.26.2 '@babel/parser': 7.26.2 @@ -15528,18 +16180,18 @@ snapshots: '@radix-ui/react-toggle': 1.1.10(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-tooltip': 1.1.6(@types/react-dom@19.1.9(@types/react@19.1.15))(@types/react@19.1.15)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@sentry/node': 6.19.7 - '@storybook/addon-actions': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-essentials': 8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-interactions': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-links': 8.6.14(react@18.3.1)(storybook@8.6.14(prettier@3.6.2)) - '@storybook/builder-vite': 8.6.14(storybook@8.6.14(prettier@3.6.2))(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) - '@storybook/react': 8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.6.2)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.6.2))(typescript@4.7.4) - '@storybook/react-vite': 8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.6.2)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.52.5)(storybook@8.6.14(prettier@3.6.2))(typescript@4.7.4)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) - '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/addon-actions': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-essentials': 8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-interactions': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-links': 8.6.14(react@18.3.1)(storybook@8.6.14(prettier@3.8.3)) + '@storybook/builder-vite': 8.6.14(storybook@8.6.14(prettier@3.8.3))(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) + '@storybook/react': 8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.8.3)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.8.3))(typescript@4.7.4) + '@storybook/react-vite': 8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.8.3)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.52.5)(storybook@8.6.14(prettier@3.8.3))(typescript@4.7.4)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) + '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.8.3)) '@vitejs/plugin-react': 4.7.0(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) ansi-to-html: 0.7.2 babel-plugin-macros: 3.1.0 - babel-plugin-styled-components: 2.1.4(@babel/core@7.24.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) + babel-plugin-styled-components: 2.1.4(@babel/core@7.28.4)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) chalk: 5.4.1 class-variance-authority: 0.7.0 cli-progress: 3.12.0 @@ -15557,8 +16209,8 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) request: 2.88.2 - storybook: 8.6.14(prettier@3.6.2) - styled-jsx: 5.1.2(@babel/core@7.24.5)(babel-plugin-macros@3.1.0)(react@18.3.1) + storybook: 8.6.14(prettier@3.8.3) + styled-jsx: 5.1.2(@babel/core@7.28.4)(babel-plugin-macros@3.1.0)(react@18.3.1) tailwind-merge: 2.6.0 tailwindcss-animate: 1.0.7 typescript: 4.7.4 @@ -16363,6 +17015,8 @@ snapshots: '@next/swc-win32-x64-msvc@16.1.6': optional: true + '@noble/hashes@2.2.0': {} + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -16586,10 +17240,6 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@planetscale/database@1.18.0': {} - - '@planetscale/database@1.19.0': {} - '@playwright/test@1.58.2': dependencies: playwright: 1.58.2 @@ -16609,11 +17259,302 @@ snapshots: '@polka/url@1.0.0-next.29': optional: true - '@prisma/adapter-planetscale@6.19.1': + '@prisma-next/adapter-postgres@file:packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz(typanion@3.14.0)': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/contract-authoring': file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz + '@prisma-next/family-sql': file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/ids': file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-contract-psl': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz + '@prisma-next/sql-contract-ts': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/sql-runtime': file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz + '@prisma-next/sql-schema-ir': file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz + '@prisma-next/target-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz(typanion@3.14.0) + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + transitivePeerDependencies: + - magicast + - typanion + + '@prisma-next/cli@file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz(typanion@3.14.0)': + dependencies: + '@clack/prompts': 1.3.0 + '@dagrejs/dagre': 3.0.0 + '@prisma-next/config': file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/emitter': file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz + '@prisma-next/errors': file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/migration-tools': file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz + '@prisma-next/psl-printer': file:packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + c12: 3.3.4 + clipanion: 4.0.0-rc.4(typanion@3.14.0) + closest-match: 1.3.3 + colorette: 2.0.20 + commander: 14.0.3 + esbuild: 0.28.0 + jsonc-parser: 3.3.1 + package-manager-detector: 1.6.0 + pathe: 2.0.3 + string-width: 8.2.1 + strip-ansi: 7.2.0 + wrap-ansi: 10.0.0 + transitivePeerDependencies: + - magicast + - typanion + + '@prisma-next/config@file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + + '@prisma-next/contract-authoring@file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz': {} + + '@prisma-next/contract@file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz': + dependencies: + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + '@standard-schema/spec': 1.1.0 + arktype: 2.2.0 + + '@prisma-next/driver-postgres@file:packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/errors': file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-errors': file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + pg: 8.20.0 + pg-cursor: 2.19.0(pg@8.20.0) + transitivePeerDependencies: + - pg-native + + '@prisma-next/emitter@file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + prettier: 3.8.3 + + '@prisma-next/errors@file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz': + dependencies: + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + + '@prisma-next/family-sql@file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/emitter': file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/migration-tools': file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-contract-emitter': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz + '@prisma-next/sql-contract-ts': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/sql-runtime': file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz + '@prisma-next/sql-schema-ir': file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + + '@prisma-next/framework-components@file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/ts-render': file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + '@standard-schema/spec': 1.1.0 + + '@prisma-next/ids@file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + uniku: 0.0.12 + + '@prisma-next/migration-tools@file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + pathe: 2.0.3 + prettier: 3.8.3 + + '@prisma-next/operations@file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz': {} + + '@prisma-next/postgres@file:packages/prisma/vendor/prisma-next/prisma-next-postgres-0.0.1.tgz(typanion@3.14.0)': + dependencies: + '@prisma-next/adapter-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-adapter-postgres-0.0.1.tgz(typanion@3.14.0) + '@prisma-next/cli': file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz(typanion@3.14.0) + '@prisma-next/config': file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/driver-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-driver-postgres-0.0.1.tgz + '@prisma-next/family-sql': file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/sql-builder': file:packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-contract-psl': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz + '@prisma-next/sql-contract-ts': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz + '@prisma-next/sql-orm-client': file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/sql-runtime': file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz + '@prisma-next/target-postgres': file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz(typanion@3.14.0) + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + pathe: 2.0.3 + pg: 8.20.0 + transitivePeerDependencies: + - magicast + - pg-native + - typanion + + '@prisma-next/psl-parser@file:packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz': + dependencies: + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + + '@prisma-next/psl-printer@file:packages/prisma/vendor/prisma-next/prisma-next-psl-printer-0.0.1.tgz': + dependencies: + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + + '@prisma-next/sql-builder@file:packages/prisma/vendor/prisma-next/prisma-next-sql-builder-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + + '@prisma-next/sql-contract-emitter@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-emitter-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/emitter': file:packages/prisma/vendor/prisma-next/prisma-next-emitter-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + + '@prisma-next/sql-contract-psl@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-psl-0.0.1.tgz': + dependencies: + '@prisma-next/config': file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/psl-parser': file:packages/prisma/vendor/prisma-next/prisma-next-psl-parser-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-contract-ts': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + pathe: 2.0.3 + + '@prisma-next/sql-contract-ts@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-ts-0.0.1.tgz': + dependencies: + '@prisma-next/config': file:packages/prisma/vendor/prisma-next/prisma-next-config-0.0.1.tgz + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/contract-authoring': file:packages/prisma/vendor/prisma-next/prisma-next-contract-authoring-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + pathe: 2.0.3 + ts-toolbelt: 9.6.0 + + '@prisma-next/sql-contract@file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + arktype: 2.2.0 + + '@prisma-next/sql-errors@file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz': {} + + '@prisma-next/sql-operations@file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz': + dependencies: + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + arktype: 2.2.0 + + '@prisma-next/sql-orm-client@file:packages/prisma/vendor/prisma-next/prisma-next-sql-orm-client-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/sql-runtime': file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + + '@prisma-next/sql-relational-core@file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + '@standard-schema/spec': 1.1.0 + arktype: 2.2.0 + ts-toolbelt: 9.6.0 + + '@prisma-next/sql-runtime@file:packages/prisma/vendor/prisma-next/prisma-next-sql-runtime-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/ids': file:packages/prisma/vendor/prisma-next/prisma-next-ids-0.0.1.tgz + '@prisma-next/operations': file:packages/prisma/vendor/prisma-next/prisma-next-operations-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + arktype: 2.2.0 + + '@prisma-next/sql-schema-ir@file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz': + dependencies: + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + + '@prisma-next/target-postgres@file:packages/prisma/vendor/prisma-next/prisma-next-target-postgres-0.0.1.tgz(typanion@3.14.0)': + dependencies: + '@prisma-next/cli': file:packages/prisma/vendor/prisma-next/prisma-next-cli-0.0.1.tgz(typanion@3.14.0) + '@prisma-next/contract': file:packages/prisma/vendor/prisma-next/prisma-next-contract-0.0.1.tgz + '@prisma-next/errors': file:packages/prisma/vendor/prisma-next/prisma-next-errors-0.0.1.tgz + '@prisma-next/family-sql': file:packages/prisma/vendor/prisma-next/prisma-next-family-sql-0.0.1.tgz + '@prisma-next/framework-components': file:packages/prisma/vendor/prisma-next/prisma-next-framework-components-0.0.1.tgz + '@prisma-next/migration-tools': file:packages/prisma/vendor/prisma-next/prisma-next-migration-tools-0.0.1.tgz + '@prisma-next/sql-contract': file:packages/prisma/vendor/prisma-next/prisma-next-sql-contract-0.0.1.tgz + '@prisma-next/sql-errors': file:packages/prisma/vendor/prisma-next/prisma-next-sql-errors-0.0.1.tgz + '@prisma-next/sql-operations': file:packages/prisma/vendor/prisma-next/prisma-next-sql-operations-0.0.1.tgz + '@prisma-next/sql-relational-core': file:packages/prisma/vendor/prisma-next/prisma-next-sql-relational-core-0.0.1.tgz + '@prisma-next/sql-schema-ir': file:packages/prisma/vendor/prisma-next/prisma-next-sql-schema-ir-0.0.1.tgz + '@prisma-next/ts-render': file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz + '@prisma-next/utils': file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz + '@standard-schema/spec': 1.1.0 + arktype: 2.2.0 + pathe: 2.0.3 + transitivePeerDependencies: + - magicast + - typanion + + '@prisma-next/ts-render@file:packages/prisma/vendor/prisma-next/prisma-next-ts-render-0.0.1.tgz': {} + + '@prisma-next/utils@file:packages/prisma/vendor/prisma-next/prisma-next-utils-0.0.1.tgz': {} + + '@prisma/adapter-pg@6.19.1': dependencies: - '@planetscale/database': 1.19.0 '@prisma/driver-adapter-utils': 6.19.1 - async-mutex: 0.5.0 + pg: 8.16.0 + postgres-array: 3.0.4 + transitivePeerDependencies: + - pg-native '@prisma/client@6.19.1(prisma@6.19.1(typescript@5.2.2))(typescript@5.2.2)': optionalDependencies: @@ -18769,140 +19710,140 @@ snapshots: '@standard-schema/spec@1.1.0': {} - '@storybook/addon-actions@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-actions@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 '@types/uuid': 9.0.8 dequal: 2.0.3 polished: 4.3.1 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) uuid: 9.0.1 optional: true - '@storybook/addon-backgrounds@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-backgrounds@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 memoizerific: 1.11.3 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 optional: true - '@storybook/addon-controls@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-controls@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 dequal: 2.0.3 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 optional: true - '@storybook/addon-docs@8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-docs@8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.8.3))': dependencies: '@mdx-js/react': 3.1.1(@types/react@19.1.15)(react@19.1.3) - '@storybook/blocks': 8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.6.2)) - '@storybook/csf-plugin': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/react-dom-shim': 8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.6.2)) + '@storybook/blocks': 8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.8.3)) + '@storybook/csf-plugin': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/react-dom-shim': 8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.8.3)) react: 19.1.3 react-dom: 19.1.3(react@19.1.3) - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 transitivePeerDependencies: - '@types/react' optional: true - '@storybook/addon-essentials@8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-essentials@8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.8.3))': dependencies: - '@storybook/addon-actions': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-backgrounds': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-controls': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-docs': 8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-highlight': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-measure': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-outline': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-toolbars': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/addon-viewport': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - storybook: 8.6.14(prettier@3.6.2) + '@storybook/addon-actions': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-backgrounds': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-controls': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-docs': 8.6.14(@types/react@19.1.15)(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-highlight': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-measure': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-outline': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-toolbars': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/addon-viewport': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 transitivePeerDependencies: - '@types/react' optional: true - '@storybook/addon-highlight@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-highlight@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/addon-interactions@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-interactions@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 - '@storybook/instrumenter': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/instrumenter': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.8.3)) polished: 4.3.1 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 optional: true - '@storybook/addon-links@8.6.14(react@18.3.1)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-links@8.6.14(react@18.3.1)(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 optionalDependencies: react: 18.3.1 optional: true - '@storybook/addon-measure@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-measure@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) tiny-invariant: 1.3.3 optional: true - '@storybook/addon-outline@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-outline@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 optional: true - '@storybook/addon-toolbars@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-toolbars@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/addon-viewport@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/addon-viewport@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: memoizerific: 1.11.3 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/blocks@8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/blocks@8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/icons': 1.4.0(react-dom@19.1.3(react@19.1.3))(react@19.1.3) - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 optionalDependencies: react: 19.1.3 react-dom: 19.1.3(react@19.1.3) optional: true - '@storybook/builder-vite@8.6.14(storybook@8.6.14(prettier@3.6.2))(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0))': + '@storybook/builder-vite@8.6.14(storybook@8.6.14(prettier@3.8.3))(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0))': dependencies: - '@storybook/csf-plugin': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/csf-plugin': 8.6.14(storybook@8.6.14(prettier@3.8.3)) browser-assert: 1.2.1 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) ts-dedent: 2.2.0 vite: 5.4.8(@types/node@18.11.9)(terser@5.27.0) optional: true - '@storybook/components@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/components@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/core@8.6.14(prettier@3.6.2)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/core@8.6.14(prettier@3.8.3)(storybook@8.6.14(prettier@3.8.3))': dependencies: - '@storybook/theming': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/theming': 8.6.14(storybook@8.6.14(prettier@3.8.3)) better-opn: 3.0.2 browser-assert: 1.2.1 esbuild: 0.25.10 @@ -18914,7 +19855,7 @@ snapshots: util: 0.12.5 ws: 8.18.3 optionalDependencies: - prettier: 3.6.2 + prettier: 3.8.3 transitivePeerDependencies: - bufferutil - storybook @@ -18922,9 +19863,9 @@ snapshots: - utf-8-validate optional: true - '@storybook/csf-plugin@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/csf-plugin@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) unplugin: 1.16.1 optional: true @@ -18937,91 +19878,91 @@ snapshots: react-dom: 19.1.3(react@19.1.3) optional: true - '@storybook/instrumenter@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/instrumenter@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 '@vitest/utils': 2.1.8 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/manager-api@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/manager-api@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/preview-api@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/preview-api@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/react-dom-shim@8.6.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/react-dom-shim@8.6.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.8.3))': dependencies: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/react-dom-shim@8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.6.2))': + '@storybook/react-dom-shim@8.6.14(react-dom@19.1.3(react@19.1.3))(react@19.1.3)(storybook@8.6.14(prettier@3.8.3))': dependencies: react: 19.1.3 react-dom: 19.1.3(react@19.1.3) - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/react-vite@8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.6.2)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.52.5)(storybook@8.6.14(prettier@3.6.2))(typescript@4.7.4)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0))': + '@storybook/react-vite@8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.8.3)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@4.52.5)(storybook@8.6.14(prettier@3.8.3))(typescript@4.7.4)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0))': dependencies: '@joshwooding/vite-plugin-react-docgen-typescript': 0.5.0(typescript@4.7.4)(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) '@rollup/pluginutils': 5.3.0(rollup@4.52.5) - '@storybook/builder-vite': 8.6.14(storybook@8.6.14(prettier@3.6.2))(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) - '@storybook/react': 8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.6.2)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.6.2))(typescript@4.7.4) + '@storybook/builder-vite': 8.6.14(storybook@8.6.14(prettier@3.8.3))(vite@5.4.8(@types/node@18.11.9)(terser@5.27.0)) + '@storybook/react': 8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.8.3)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.8.3))(typescript@4.7.4) find-up: 5.0.0 magic-string: 0.30.17 react: 18.3.1 react-docgen: 7.1.1 react-dom: 18.3.1(react@18.3.1) resolve: 1.22.10 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) tsconfig-paths: 4.2.0 vite: 5.4.8(@types/node@18.11.9)(terser@5.27.0) optionalDependencies: - '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.8.3)) transitivePeerDependencies: - rollup - supports-color - typescript optional: true - '@storybook/react@8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.6.2)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.6.2))(typescript@4.7.4)': + '@storybook/react@8.6.14(@storybook/test@8.6.14(storybook@8.6.14(prettier@3.8.3)))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.8.3))(typescript@4.7.4)': dependencies: - '@storybook/components': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/components': 8.6.14(storybook@8.6.14(prettier@3.8.3)) '@storybook/global': 5.0.0 - '@storybook/manager-api': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/preview-api': 8.6.14(storybook@8.6.14(prettier@3.6.2)) - '@storybook/react-dom-shim': 8.6.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.6.2)) - '@storybook/theming': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/manager-api': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/preview-api': 8.6.14(storybook@8.6.14(prettier@3.8.3)) + '@storybook/react-dom-shim': 8.6.14(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(storybook@8.6.14(prettier@3.8.3)) + '@storybook/theming': 8.6.14(storybook@8.6.14(prettier@3.8.3)) react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optionalDependencies: - '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/test': 8.6.14(storybook@8.6.14(prettier@3.8.3)) typescript: 4.7.4 optional: true - '@storybook/test@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/test@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: '@storybook/global': 5.0.0 - '@storybook/instrumenter': 8.6.14(storybook@8.6.14(prettier@3.6.2)) + '@storybook/instrumenter': 8.6.14(storybook@8.6.14(prettier@3.8.3)) '@testing-library/dom': 10.4.0 '@testing-library/jest-dom': 6.5.0 '@testing-library/user-event': 14.5.2(@testing-library/dom@10.4.0) '@vitest/expect': 2.0.5 '@vitest/spy': 2.0.5 - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true - '@storybook/theming@8.6.14(storybook@8.6.14(prettier@3.6.2))': + '@storybook/theming@8.6.14(storybook@8.6.14(prettier@3.8.3))': dependencies: - storybook: 8.6.14(prettier@3.6.2) + storybook: 8.6.14(prettier@3.8.3) optional: true '@stripe/stripe-js@7.3.1': {} @@ -19640,6 +20581,12 @@ snapshots: '@types/parse-json@4.0.2': optional: true + '@types/pg@8.11.11': + dependencies: + '@types/node': 18.11.9 + pg-protocol: 1.10.3 + pg-types: 4.1.0 + '@types/prettier@2.7.3': {} '@types/prompts@2.4.9': @@ -20301,6 +21248,8 @@ snapshots: ansi-regex@6.0.1: {} + ansi-regex@6.2.2: {} + ansi-styles@3.2.1: dependencies: color-convert: 1.9.3 @@ -20313,6 +21262,8 @@ snapshots: ansi-styles@6.2.1: {} + ansi-styles@6.2.3: {} + ansi-to-html@0.7.2: dependencies: entities: 2.2.0 @@ -20382,6 +21333,16 @@ snapshots: aria-query@5.3.2: optional: true + arkregex@0.0.5: + dependencies: + '@ark/util': 0.56.0 + + arktype@2.2.0: + dependencies: + '@ark/schema': 0.56.0 + '@ark/util': 0.56.0 + arkregex: 0.0.5 + array-buffer-byte-length@1.0.0: dependencies: call-bind: 1.0.7 @@ -20481,10 +21442,6 @@ snapshots: astral-regex@2.0.0: {} - async-mutex@0.5.0: - dependencies: - tslib: 2.8.1 - async@3.2.6: {} asynckit@0.4.0: {} @@ -20614,11 +21571,11 @@ snapshots: resolve: 1.22.6 optional: true - babel-plugin-styled-components@2.1.4(@babel/core@7.24.5)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1)): + babel-plugin-styled-components@2.1.4(@babel/core@7.28.4)(styled-components@6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1)): dependencies: '@babel/helper-annotate-as-pure': 7.27.3 '@babel/helper-module-imports': 7.25.9 - '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.24.5) + '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.4) lodash: 4.17.21 picomatch: 2.3.1 styled-components: 6.1.19(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -20880,6 +21837,21 @@ snapshots: pkg-types: 2.3.0 rc9: 2.1.2 + c12@3.3.4: + dependencies: + chokidar: 5.0.0 + confbox: 0.2.4 + defu: 6.1.7 + dotenv: 17.4.2 + exsolve: 1.0.8 + giget: 3.2.0 + jiti: 2.6.1 + ohash: 2.0.11 + pathe: 2.0.3 + perfect-debounce: 2.1.0 + pkg-types: 2.3.0 + rc9: 3.0.1 + cac@6.7.14: {} cacache@15.3.0: @@ -21036,6 +22008,10 @@ snapshots: dependencies: readdirp: 4.1.2 + chokidar@5.0.0: + dependencies: + readdirp: 5.0.0 + chownr@1.1.4: {} chownr@2.0.0: {} @@ -21094,6 +22070,10 @@ snapshots: client-only@0.0.1: {} + clipanion@4.0.0-rc.4(typanion@3.14.0): + dependencies: + typanion: 3.14.0 + cliui@7.0.4: dependencies: string-width: 4.2.3 @@ -21110,6 +22090,8 @@ snapshots: clone@2.1.2: {} + closest-match@1.3.3: {} + clsx@2.0.0: {} clsx@2.1.1: {} @@ -21156,6 +22138,8 @@ snapshots: color-support@1.1.3: optional: true + colorette@2.0.20: {} + combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 @@ -21166,6 +22150,8 @@ snapshots: commander@13.0.0: {} + commander@14.0.3: {} + commander@2.20.3: optional: true @@ -21207,6 +22193,8 @@ snapshots: confbox@0.2.2: {} + confbox@0.2.4: {} + config-chain@1.1.13: dependencies: ini: 1.3.8 @@ -21586,6 +22574,8 @@ snapshots: defu@6.1.4: {} + defu@6.1.7: {} + delaunator@5.0.0: dependencies: robust-predicates: 3.0.2 @@ -21727,6 +22717,8 @@ snapshots: dotenv@16.6.1: {} + dotenv@17.4.2: {} + dotenv@8.6.0: {} dub@0.43.0(zod@3.23.8): @@ -22255,6 +23247,35 @@ snapshots: '@esbuild/win32-ia32': 0.25.12 '@esbuild/win32-x64': 0.25.12 + esbuild@0.28.0: + optionalDependencies: + '@esbuild/aix-ppc64': 0.28.0 + '@esbuild/android-arm': 0.28.0 + '@esbuild/android-arm64': 0.28.0 + '@esbuild/android-x64': 0.28.0 + '@esbuild/darwin-arm64': 0.28.0 + '@esbuild/darwin-x64': 0.28.0 + '@esbuild/freebsd-arm64': 0.28.0 + '@esbuild/freebsd-x64': 0.28.0 + '@esbuild/linux-arm': 0.28.0 + '@esbuild/linux-arm64': 0.28.0 + '@esbuild/linux-ia32': 0.28.0 + '@esbuild/linux-loong64': 0.28.0 + '@esbuild/linux-mips64el': 0.28.0 + '@esbuild/linux-ppc64': 0.28.0 + '@esbuild/linux-riscv64': 0.28.0 + '@esbuild/linux-s390x': 0.28.0 + '@esbuild/linux-x64': 0.28.0 + '@esbuild/netbsd-arm64': 0.28.0 + '@esbuild/netbsd-x64': 0.28.0 + '@esbuild/openbsd-arm64': 0.28.0 + '@esbuild/openbsd-x64': 0.28.0 + '@esbuild/openharmony-arm64': 0.28.0 + '@esbuild/sunos-x64': 0.28.0 + '@esbuild/win32-arm64': 0.28.0 + '@esbuild/win32-ia32': 0.28.0 + '@esbuild/win32-x64': 0.28.0 + escalade@3.1.2: {} escalade@3.2.0: {} @@ -22606,8 +23627,18 @@ snapshots: fast-sha256@1.3.0: {} + fast-string-truncated-width@3.0.3: {} + + fast-string-width@3.0.2: + dependencies: + fast-string-truncated-width: 3.0.3 + fast-uri@3.1.0: {} + fast-wrap-ansi@0.2.0: + dependencies: + fast-string-width: 3.0.2 + fast-xml-parser@4.4.1: dependencies: strnum: 1.0.5 @@ -22940,6 +23971,8 @@ snapshots: get-east-asian-width@1.4.0: {} + get-east-asian-width@1.5.0: {} + get-intrinsic@1.2.4: dependencies: es-errors: 1.3.0 @@ -23005,6 +24038,8 @@ snapshots: nypm: 0.6.2 pathe: 2.0.3 + giget@3.2.0: {} + github-from-package@0.0.0: {} glob-parent@5.1.2: @@ -24475,6 +25510,8 @@ snapshots: json5@2.2.3: {} + jsonc-parser@3.3.1: {} + jsondiffpatch@0.6.0: dependencies: '@types/diff-match-patch': 1.0.36 @@ -25622,6 +26659,8 @@ snapshots: obliterator@1.6.1: {} + obuf@1.1.2: {} + ohash@2.0.11: {} oidc-token-hash@5.1.1: {} @@ -25797,6 +26836,8 @@ snapshots: registry-url: 6.0.1 semver: 7.6.2 + package-manager-detector@1.6.0: {} + pako@0.2.9: {} pako@1.0.11: {} @@ -25896,22 +26937,41 @@ snapshots: perfect-debounce@1.0.0: {} + perfect-debounce@2.1.0: {} + performance-now@2.1.0: optional: true pg-cloudflare@1.2.5: optional: true + pg-cloudflare@1.3.0: + optional: true + + pg-connection-string@2.12.0: {} + pg-connection-string@2.9.1: {} + pg-cursor@2.19.0(pg@8.20.0): + dependencies: + pg: 8.20.0 + pg-int8@1.0.1: {} + pg-numeric@1.0.2: {} + pg-pool@3.10.1(pg@8.16.0): dependencies: pg: 8.16.0 + pg-pool@3.13.0(pg@8.20.0): + dependencies: + pg: 8.20.0 + pg-protocol@1.10.3: {} + pg-protocol@1.13.0: {} + pg-types@2.2.0: dependencies: pg-int8: 1.0.1 @@ -25920,6 +26980,16 @@ snapshots: postgres-date: 1.0.7 postgres-interval: 1.2.0 + pg-types@4.1.0: + dependencies: + pg-int8: 1.0.1 + pg-numeric: 1.0.2 + postgres-array: 3.0.4 + postgres-bytea: 3.0.0 + postgres-date: 2.1.0 + postgres-interval: 3.0.0 + postgres-range: 1.1.4 + pg@8.16.0: dependencies: pg-connection-string: 2.9.1 @@ -25930,6 +27000,16 @@ snapshots: optionalDependencies: pg-cloudflare: 1.2.5 + pg@8.20.0: + dependencies: + pg-connection-string: 2.12.0 + pg-pool: 3.13.0(pg@8.20.0) + pg-protocol: 1.13.0 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.3.0 + pgpass@1.0.5: dependencies: split2: 4.2.0 @@ -26103,14 +27183,26 @@ snapshots: postgres-array@2.0.0: {} + postgres-array@3.0.4: {} + postgres-bytea@1.0.0: {} + postgres-bytea@3.0.0: + dependencies: + obuf: 1.1.2 + postgres-date@1.0.7: {} + postgres-date@2.1.0: {} + postgres-interval@1.2.0: dependencies: xtend: 4.0.2 + postgres-interval@3.0.0: {} + + postgres-range@1.1.4: {} + preact-render-to-string@5.2.6(preact@10.24.3): dependencies: preact: 10.24.3 @@ -26152,6 +27244,8 @@ snapshots: prettier@3.6.2: {} + prettier@3.8.3: {} + pretty-format@26.6.2: dependencies: '@jest/types': 26.6.2 @@ -26429,6 +27523,11 @@ snapshots: defu: 6.1.4 destr: 2.0.5 + rc9@3.0.1: + dependencies: + defu: 6.1.7 + destr: 2.0.5 + rc@1.2.8: dependencies: deep-extend: 0.6.0 @@ -26694,6 +27793,8 @@ snapshots: readdirp@4.1.2: {} + readdirp@5.0.0: {} + recast@0.23.11: dependencies: ast-types: 0.16.1 @@ -27502,11 +28603,11 @@ snapshots: stoppable@1.1.0: {} - storybook@8.6.14(prettier@3.6.2): + storybook@8.6.14(prettier@3.8.3): dependencies: - '@storybook/core': 8.6.14(prettier@3.6.2)(storybook@8.6.14(prettier@3.6.2)) + '@storybook/core': 8.6.14(prettier@3.8.3)(storybook@8.6.14(prettier@3.8.3)) optionalDependencies: - prettier: 3.6.2 + prettier: 3.8.3 transitivePeerDependencies: - bufferutil - supports-color @@ -27573,6 +28674,11 @@ snapshots: get-east-asian-width: 1.4.0 strip-ansi: 7.1.0 + string-width@8.2.1: + dependencies: + get-east-asian-width: 1.5.0 + strip-ansi: 7.2.0 + string.prototype.codepointat@0.2.1: {} string.prototype.matchall@4.0.11: @@ -27648,6 +28754,10 @@ snapshots: dependencies: ansi-regex: 6.0.1 + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.2.2 + strip-bom@3.0.0: {} strip-bom@4.0.0: {} @@ -27715,12 +28825,12 @@ snapshots: tslib: 2.6.2 optional: true - styled-jsx@5.1.2(@babel/core@7.24.5)(babel-plugin-macros@3.1.0)(react@18.3.1): + styled-jsx@5.1.2(@babel/core@7.28.4)(babel-plugin-macros@3.1.0)(react@18.3.1): dependencies: client-only: 0.0.1 react: 18.3.1 optionalDependencies: - '@babel/core': 7.24.5 + '@babel/core': 7.28.4 babel-plugin-macros: 3.1.0 optional: true @@ -28260,6 +29370,8 @@ snapshots: '@swc/core': 1.3.101(@swc/helpers@0.5.15) optional: true + ts-toolbelt@9.6.0: {} + tsconfck@3.0.3(typescript@5.4.4): optionalDependencies: typescript: 5.4.4 @@ -28478,6 +29590,8 @@ snapshots: tweetnacl@0.14.5: optional: true + typanion@3.14.0: {} + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -28655,6 +29769,10 @@ snapshots: trough: 2.1.0 vfile: 6.0.2 + uniku@0.0.12: + dependencies: + '@noble/hashes': 2.2.0 + unique-filename@1.1.1: dependencies: unique-slug: 2.0.2 @@ -29178,6 +30296,12 @@ snapshots: dependencies: string-width: 7.2.0 + wrap-ansi@10.0.0: + dependencies: + ansi-styles: 6.2.3 + string-width: 8.2.1 + strip-ansi: 7.2.0 + wrap-ansi@6.2.0: dependencies: ansi-styles: 4.3.0