The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
mvp
Kiran K55bc20b4b09f
diff --git a/apps/web/lib/api/links/get-links-for-workspace.ts b/apps/web/lib/api/links/get-links-for-workspace.tsindex 3f48d9da66..d965e0479d 100644--- a/apps/web/lib/api/links/get-links-for-workspace.ts+++ b/apps/web/lib/api/links/get-links-for-workspace.ts@@ -1,6 +1,6 @@-import { prisma } from "@/lib/prisma";import z from "@/lib/zod";import { getLinksQuerySchemaExtended } from "@/lib/zod/schemas/links";+import { prisma } from "@dub/prisma";import { combineTagIds, transformLink } from "./utils";export async function getLinksForWorkspace({diff --git a/apps/web/next.config.js b/apps/web/next.config.jsindex 3e1a4860ab..33564fccc3 100644--- a/apps/web/next.config.js+++ b/apps/web/next.config.js@@ -12,7 +12,7 @@ const { withAxiom } = require("next-axiom");/** @type {import('next').NextConfig} */module.exports = withAxiom({reactStrictMode: false,- transpilePackages: ["shiki"],+ transpilePackages: ["shiki", "@dub/prisma"],experimental: {serverComponentsExternalPackages: ["@react-email/components",diff --git a/apps/web/package.json b/apps/web/package.jsonindex 35546e7d66..cb79008416 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -20,6 +20,7 @@"@dub/tailwind-config": "workspace:*","@dub/ui": "workspace:*","@dub/utils": "workspace:*",+ "@dub/prisma": "workspace:*","@hookform/resolvers": "^3.9.0","@next-auth/prisma-adapter": "^1.0.5","@planetscale/database": "^1.18.0",diff --git a/packages/prisma/.gitignore b/packages/prisma/.gitignorenew file mode 100644index 0000000000..0e83570dd5--- /dev/null+++ b/packages/prisma/.gitignore@@ -0,0 +1 @@+generated/client\ No newline at end of filediff --git a/packages/prisma/client.ts b/packages/prisma/client.tsnew file mode 100644index 0000000000..fcab163dab--- /dev/null+++ b/packages/prisma/client.ts@@ -0,0 +1 @@+export * from "@prisma/client";diff --git a/packages/prisma/edge.ts b/packages/prisma/edge.tsnew file mode 100644index 0000000000..08185a2912--- /dev/null+++ b/packages/prisma/edge.ts@@ -0,0 +1,11 @@+import { Client } from "@planetscale/database";+import { PrismaPlanetScale } from "@prisma/adapter-planetscale";+import { PrismaClient } from "@prisma/client";++const client = new Client({ url: process.env.DATABASE_URL });++const adapter = new PrismaPlanetScale(client);++export const prismaEdge = new PrismaClient({+ adapter,+});diff --git a/packages/prisma/index.ts b/packages/prisma/index.tsnew file mode 100644index 0000000000..80442f7c96--- /dev/null+++ b/packages/prisma/index.ts@@ -0,0 +1,19 @@+import { PrismaClient } from "@prisma/client";++export const prisma =+ global.prisma ||+ new PrismaClient({+ omit: {+ user: { passwordHash: true },+ },+ });++declare global {+ var prisma:+ | PrismaClient<{ omit: { user: { passwordHash: true } } }>+ | undefined;+}++if (process.env.NODE_ENV === "development") global.prisma = prisma;++console.log("Prisma loaded from @dub/prisma");diff --git a/packages/prisma/package.json b/packages/prisma/package.jsonnew file mode 100644index 0000000000..1e4f473078--- /dev/null+++ b/packages/prisma/package.json@@ -0,0 +1,23 @@+{+ "name": "@dub/prisma",+ "version": "0.0.0",+ "main": "./index.ts",+ "types": "./index.ts",+ "license": "MIT",+ "scripts": {+ "prisma:generate": "npx prisma generate --schema=./schema",+ "prisma:push": "npx prisma db push --schema=./schema",+ "prisma:studio": "npx prisma studio --schema=./schema --browser none"+ },+ "dependencies": {+ "@planetscale/database": "^1.18.0",+ "@prisma/adapter-planetscale": "^5.18.0",+ "@prisma/client": "5.18.0"+ },+ "devDependencies": {+ "@types/node": "18.11.9",+ "prisma": "5.18.0",+ "tsx": "^4.11.0",+ "typescript": "5.2.2"+ }+}diff --git a/packages/prisma/schema/customer.prisma b/packages/prisma/schema/customer.prismanew file mode 100644index 0000000000..b9dfbde27b--- /dev/null+++ b/packages/prisma/schema/customer.prisma@@ -0,0 +1,20 @@+model Customer {+ id String @id @default(cuid())+ name String?+ email String?+ avatar String?+ externalId String?+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ projectId String+ projectConnectId String?+ stripeCustomerId String? @unique++ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt++ @@unique([projectId, externalId])+ @@unique([projectConnectId, externalId])+ @@index(projectId)+ @@index(projectConnectId)+ @@index(externalId)+}diff --git a/packages/prisma/schema/domain.prisma b/packages/prisma/schema/domain.prismanew file mode 100644index 0000000000..9216da579c--- /dev/null+++ b/packages/prisma/schema/domain.prisma@@ -0,0 +1,54 @@+model Domain {+ id String @id @default(cuid())+ 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+ primary Boolean @default(false)+ archived Boolean @default(false)+ lastChecked DateTime @default(now())+ links Link[]+ project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)+ projectId String?+ registeredDomain RegisteredDomain?++ // these attributes will exist on both Link and Domain models+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt++ @@index(projectId)+ @@index(lastChecked(sort: Asc))+}++model RegisteredDomain {+ id String @id @default(cuid())+ slug String+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ expiresAt DateTime++ project Project @relation(fields: [projectId], references: [id])+ projectId String+ domain Domain? @relation(fields: [domainId], references: [id], onDelete: SetNull)+ domainId String? @unique++ @@index(projectId)+ @@index(expiresAt(sort: Asc))+}++model DefaultDomains {+ id String @id @default(cuid())+ dublink Boolean @default(false)+ 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)+}\ No newline at end of filediff --git a/packages/prisma/schema/integration.prisma b/packages/prisma/schema/integration.prismanew file mode 100644index 0000000000..fd1408e557--- /dev/null+++ b/packages/prisma/schema/integration.prisma@@ -0,0 +1,45 @@+model Integration {+ id String @id @default(cuid())+ userId String?+ projectId String+ name String+ slug String @unique+ description String?+ readme String? @db.LongText+ developer String+ website String+ logo String?+ screenshots Json?+ verified Boolean @default(false)+ installUrl String?+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt++ user User? @relation(fields: [userId], references: [id], onDelete: SetNull)+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ oAuthApp OAuthApp?+ installations InstalledIntegration[]++ @@index([projectId])+ @@index([userId])+}++model InstalledIntegration {+ id String @id @default(cuid())+ userId String // user who installed the integration+ integrationId String // integration that was installed+ projectId String // workspace where integration was installed+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ credentials 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[]++ @@unique([userId, integrationId, projectId])+ @@index([projectId])+ @@index([integrationId])+}diff --git a/packages/prisma/schema/jackson.prisma b/packages/prisma/schema/jackson.prismanew file mode 100644index 0000000000..738b0b3441--- /dev/null+++ b/packages/prisma/schema/jackson.prisma@@ -0,0 +1,27 @@+model jackson_index {+ id Int @id @default(autoincrement())+ key String @db.VarChar(250)+ storeKey String @db.VarChar(250)++ @@index([key], map: "_jackson_index_key")+ @@index([key, storeKey], map: "_jackson_index_key_store")+}++model jackson_store {+ key String @id @db.VarChar(250)+ value String @db.Text+ iv String? @db.VarChar(64)+ tag String? @db.VarChar(64)+ namespace String? @db.VarChar(64)+ createdAt DateTime @default(now()) @db.Timestamp(0)+ modifiedAt DateTime? @db.Timestamp(0)++ @@index([namespace], map: "_jackson_store_namespace")+}++model jackson_ttl {+ key String @id @db.VarChar(250)+ expiresAt BigInt++ @@index([expiresAt], map: "_jackson_ttl_expires_at")+}diff --git a/packages/prisma/schema/link.prisma b/packages/prisma/schema/link.prismanew file mode 100644index 0000000000..96b2d64ce8--- /dev/null+++ b/packages/prisma/schema/link.prisma@@ -0,0 +1,80 @@+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+ 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+ expiredUrl String? @db.LongText // URL to redirect the user to when the link is expired+ password String? // password to access the link+ externalId String?+ identifier String?+ 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.co - Open-Source Link Management Infrastructure)+ description String? @db.VarChar(280) // OG description for the link (e.g. An open-source link management tool for modern marketing teams to create, share, and track short links.)+ image String? @db.LongText // OG image for the link (e.g. https://d.to/og)+ video String? @db.LongText // 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)++ // Link cloaking/masking via rewrite+ rewrite Boolean @default(false) // whether to rewrite the link or not++ doIndex Boolean @default(false) // we don't index short links by default++ // Custom device targeting+ ios String? @db.LongText // custom link for iOS devices+ android String? @db.LongText // custom link for Android devices+ geo Json? @db.Json // custom link for specific countries++ // 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?+ // Relational reference to the project domain+ projectDomain Domain? @relation(fields: [domain], references: [slug], onUpdate: Cascade, onDelete: Cascade)++ publicStats Boolean @default(false) // whether to show public stats or not+ clicks Int @default(0) // number of clicks+ lastClicked DateTime? // when the link was last clicked+ leads Int @default(0)+ sales Int @default(0) // number of sales+ saleAmount Int @default(0) // total dollar value of sales (in cents)+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt++ // Link tags+ tags LinkTag[]++ // Link webhooks+ webhooks LinkWebhook[]++ // Comments on the particular shortlink+ comments String? @db.LongText++ @@unique([domain, key])+ @@unique([projectId, externalId])+ @@unique([projectId, identifier])+ @@index(projectId)+ @@index(domain)+ @@index(trackConversion)+ @@index(proxy)+ @@index(password)+ @@index(archived)+ @@index(createdAt(sort: Desc))+ @@index(clicks(sort: Desc))+ @@index(lastClicked)+ @@index(userId)+ @@fulltext([key, url])+}\ No newline at end of filediff --git a/packages/prisma/schema/oauth.prisma b/packages/prisma/schema/oauth.prismanew file mode 100644index 0000000000..a20286539f--- /dev/null+++ b/packages/prisma/schema/oauth.prisma@@ -0,0 +1,49 @@+model OAuthApp {+ id String @id @default(cuid())+ 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)+}++model OAuthCode {+ id String @id @default(cuid())+ 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 DateTime+ createdAt DateTime @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])+}++model OAuthRefreshToken {+ id String @id @default(cuid())+ installationId String+ accessTokenId String+ hashedRefreshToken String @unique+ expiresAt DateTime+ createdAt DateTime @default(now())++ accessToken RestrictedToken @relation(fields: [accessTokenId], references: [id], onDelete: Cascade)+ installedIntegration InstalledIntegration @relation(fields: [installationId], references: [id], onDelete: Cascade)++ @@index([installationId])+ @@index([accessTokenId])+}diff --git a/packages/prisma/schema/schema.prisma b/packages/prisma/schema/schema.prismanew file mode 100644index 0000000000..d2633e1976--- /dev/null+++ b/packages/prisma/schema/schema.prisma@@ -0,0 +1,78 @@+datasource db {+ provider = "mysql"+ url = env("DATABASE_URL")+ relationMode = "prisma"+}++generator client {+ provider = "prisma-client-js"+ previewFeatures = ["fullTextSearch", "fullTextIndex", "driverAdapters", "prismaSchemaFolder", "omitApi"]+}++model User {+ id String @id @default(cuid())+ name String?+ email String? @unique+ emailVerified DateTime?+ image String?+ isMachine Boolean @default(false)++ // password data+ passwordHash String?+ invalidLoginAttempts Int @default(0)+ lockedAt DateTime?++ createdAt DateTime @default(now())+ subscribed Boolean @default(true) // email subscription+ source String? // where the user came from+ defaultWorkspace String? // slug of the user's default workspace+ referredByWorkspace Project? @relation(fields: [referredByWorkspaceId], references: [id])+ referredByWorkspaceId String? // ID of the workspace that referred this user++ // relational data+ accounts Account[]+ sessions Session[]+ projects ProjectUsers[]+ links Link[]+ tokens Token[]+ restrictedTokens RestrictedToken[]+ oAuthCodes OAuthCode[]+ integrations Integration[] // Integrations user created in their workspace+ installedIntegrations InstalledIntegration[] // Integrations user installed in their workspace+ utmTemplates UtmTemplate[]++ @@index(source)+ @@index(defaultWorkspace)+ @@index([referredByWorkspaceId])+}++model Account {+ id String @id @default(cuid())+ userId String+ type String+ provider String+ providerAccountId String+ refresh_token String? @db.Text+ refresh_token_expires_in Int?+ access_token String? @db.Text+ expires_at Int?+ token_type String?+ scope String?+ id_token String? @db.Text+ session_state String?++ user User @relation(fields: [userId], references: [id], onDelete: Cascade)++ @@unique([provider, providerAccountId])+ @@index([userId])+}++model Session {+ id String @id @default(cuid())+ sessionToken String @unique+ userId String+ expires DateTime+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)++ @@index([userId])+}diff --git a/packages/prisma/schema/tag.prisma b/packages/prisma/schema/tag.prismanew file mode 100644index 0000000000..b765a5e9fd--- /dev/null+++ b/packages/prisma/schema/tag.prisma@@ -0,0 +1,27 @@+model Tag {+ id String @id @default(cuid())+ name String+ color String @default("blue")+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ project Project @relation(fields: [projectId], references: [id], onUpdate: Cascade, onDelete: Cascade)+ projectId String+ links LinkTag[]++ @@unique([name, projectId])+ @@index(projectId)+}++model LinkTag {+ id String @id @default(cuid())+ createdAt DateTime @default(now())+ updatedAt DateTime @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(linkId)+ @@index(tagId)+}diff --git a/packages/prisma/schema/token.prisma b/packages/prisma/schema/token.prismanew file mode 100644index 0000000000..745af51753--- /dev/null+++ b/packages/prisma/schema/token.prisma@@ -0,0 +1,67 @@+model Token {+ id String @id @default(cuid())+ name String+ hashedKey String @unique+ partialKey String+ expires DateTime?+ lastUsed DateTime?+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)+ userId String++ @@index([userId])+}++model RestrictedToken {+ id String @id @default(cuid())+ name String+ hashedKey String @unique+ partialKey String+ scopes String? // space separated (Eg: "links:write", "domains:read")+ expires DateTime?+ lastUsed DateTime?+ rateLimit Int @default(60) // rate limit per minute+ createdAt DateTime @default(now())+ updatedAt DateTime @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)+ // authorizedApp OAuthAuthorizedApp? @relation(fields: [installationId], references: [id], onDelete: Cascade)+ refreshTokens OAuthRefreshToken[]+ installedIntegration InstalledIntegration? @relation(fields: [installationId], references: [id], onDelete: Cascade)++ @@index([userId])+ @@index([projectId])+ @@index([installationId])+}++// Login tokens+model VerificationToken {+ identifier String+ token String @unique+ expires DateTime++ @@unique([identifier, token])+}++// Email verification OTPs+model EmailVerificationToken {+ identifier String+ token String @unique+ expires DateTime++ @@unique([identifier, token])+}++// Password reset tokens+model PasswordResetToken {+ identifier String+ token String @unique+ expires DateTime++ @@unique([identifier, token])+}\ No newline at end of filediff --git a/packages/prisma/schema/utm.prisma b/packages/prisma/schema/utm.prismanew file mode 100644index 0000000000..4fd0e2db14--- /dev/null+++ b/packages/prisma/schema/utm.prisma@@ -0,0 +1,27 @@+model UtmTemplate {+ id String @id @default(cuid())+ 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 DateTime @default(now())+ updatedAt DateTime @updatedAt++ @@index(userId)+ @@index(projectId)+ @@unique([projectId, name])+}diff --git a/packages/prisma/schema/webhook.prisma b/packages/prisma/schema/webhook.prismanew file mode 100644index 0000000000..536c6e9638--- /dev/null+++ b/packages/prisma/schema/webhook.prisma@@ -0,0 +1,35 @@+enum WebhookReceiver {+ user+ zapier+ make+}++model Webhook {+ id String @id @default(cuid())+ receiver WebhookReceiver+ projectId String+ name String+ url String+ secret String+ triggers Json+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt++ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ links LinkWebhook[]++ @@index([projectId])+}++model LinkWebhook {+ id String @id @default(cuid())+ 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([linkId])+ @@index([webhookId])+}diff --git a/packages/prisma/schema/workspace.prisma b/packages/prisma/schema/workspace.prismanew file mode 100644index 0000000000..e8a5291a37--- /dev/null+++ b/packages/prisma/schema/workspace.prisma@@ -0,0 +1,108 @@+model Project {+ id String @id @default(cuid())+ name String+ slug String @unique+ logo String?+ inviteCode String? @unique++ plan String @default("free")+ stripeId String? @unique // Stripe subscription ID+ billingCycleStart Int // day of the month when the billing cycle starts+ paymentFailedAt DateTime?+ stripeConnectId String? @unique // for Stripe Connect++ usage Int @default(0)+ usageLimit Int @default(1000)+ linksUsage Int @default(0)+ linksLimit Int @default(25)+ salesUsage Int @default(0)+ salesLimit Int @default(0)+ domainsLimit Int @default(3)+ tagsLimit Int @default(5)+ usersLimit Int @default(1)+ aiUsage Int @default(0)+ aiLimit Int @default(10)++ referralLinkId String? @unique+ referredSignups Int @default(0)+ referredUsers User[]++ webhookEnabled Boolean @default(false)+ conversionEnabled Boolean @default(false)+ ssoEnabled Boolean @default(false)+ dotLinkClaimed Boolean @default(false)++ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ usageLastChecked DateTime @default(now())+ publishableKey String? @unique++ users ProjectUsers[]+ invites ProjectInvite[]+ sentEmails SentEmail[]+ links Link[]+ domains Domain[]+ tags Tag[]+ customers Customer[]+ defaultDomains DefaultDomains[]+ restrictedTokens RestrictedToken[]+ oAuthCodes OAuthCode[]+ integrations Integration[] // Integrations workspace published+ installedIntegrations InstalledIntegration[] // Integrations workspace installed+ webhooks Webhook[]+ registeredDomains RegisteredDomain[]+ utmTemplates UtmTemplate[]++ @@index(usageLastChecked(sort: Asc))+}++enum Role {+ owner+ member+}++model ProjectInvite {+ email String+ expires DateTime+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ projectId String+ role Role @default(member)+ createdAt DateTime @default(now())++ @@unique([email, projectId])+ @@index([projectId])+}++model ProjectUsers {+ id String @id @default(cuid())+ role Role @default(member)+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)+ userId String+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ projectId String+ notificationPreference NotificationPreference?++ @@unique([userId, projectId])+ @@index([projectId])+}++model SentEmail {+ id String @id @default(cuid())+ type String+ createdAt DateTime @default(now())+ project Project? @relation(fields: [projectId], references: [id], onDelete: Cascade)+ projectId String?++ @@index([projectId])+}++model NotificationPreference {+ id String @id @default(cuid())+ projectUserId String @unique+ linkUsageSummary Boolean @default(true)+ domainConfigurationUpdates Boolean @default(true)++ projectUser ProjectUsers @relation(fields: [projectUserId], references: [id], onDelete: Cascade)+}diff --git a/packages/prisma/tsconfig.json b/packages/prisma/tsconfig.jsonnew file mode 100644index 0000000000..59ccadf867--- /dev/null+++ b/packages/prisma/tsconfig.json@@ -0,0 +1,26 @@+{+ "$schema": "https://json.schemastore.org/tsconfig",+ "display": "Default",+ "compilerOptions": {+ "composite": false,+ "declaration": true,+ "declarationMap": true,+ "esModuleInterop": true,+ "forceConsistentCasingInFileNames": true,+ "inlineSources": false,+ "isolatedModules": true,+ "module": "ESNext",+ "moduleResolution": "Bundler",+ "noUnusedLocals": false,+ "noUnusedParameters": false,+ "preserveWatchOutput": true,+ "skipLibCheck": true,+ "strict": true+ },+ "include": [+ "**/*.ts",+ ],+ "exclude": [+ "node_modules"+ ]+}\ No newline at end of filediff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 21151cc6f0..4f89b2f9c3 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -47,6 +47,9 @@ importers:'@dub/blocks':specifier: workspace:*version: link:../../packages/blocks+ '@dub/prisma':+ specifier: workspace:*+ version: link:../../packages/prisma'@dub/tailwind-config':specifier: workspace:*version: link:../../packages/tailwind-config@@ -555,6 +558,31 @@ importers:specifier: ^5.6.2version: 5.6.2+ packages/prisma:+ dependencies:+ '@planetscale/database':+ specifier: ^1.18.0+ version: 1.18.0+ '@prisma/adapter-planetscale':+ specifier: ^5.18.0+ version: 5.18.0(@planetscale/[email protected])+ '@prisma/client':+ specifier: 5.18.0+ version: 5.18.0([email protected])+ devDependencies:+ '@types/node':+ specifier: 18.11.9+ version: 18.11.9+ prisma:+ specifier: 5.18.0+ version: 5.18.0+ tsx:+ specifier: ^4.11.0+ version: 4.11.0+ typescript:+ specifier: 5.2.2+ version: 5.2.2+packages/stripe-app:dependencies:'@stripe/ui-extension-sdk':@@ -13868,6 +13896,12 @@ packages:resolve-pkg-maps: 1.0.0dev: true+ resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==}+ dependencies:+ resolve-pkg-maps: 1.0.0+ dev: true+resolution: {integrity: sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==}dev: false@@ -21071,6 +21105,17 @@ packages:fsevents: 2.3.3dev: true+ resolution: {integrity: sha512-vzGGELOgAupsNVssAmZjbUDfdm/pWP4R+Kg8TVdsonxbXk0bEpE1qh0yV6/QxUVXaVlNemgcPajGdJJ82n3stg==}+ engines: {node: '>=18.0.0'}+ hasBin: true+ dependencies:+ esbuild: 0.20.2+ get-tsconfig: 4.8.1+ optionalDependencies:+ fsevents: 2.3.3+ dev: true+resolution: {integrity: sha512-I8RtFk1b9UILAExPdG/XRgGQz95nmXPE7OiGb6ytjtNIR5/UZBS/xVX/7HYpCdmfriKdVwBKhalCoV4oDvAGEg==}cpu: [x64]@@ -21401,6 +21446,12 @@ packages:engines: {node: '>=14.17'}hasBin: true+ resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==}+ engines: {node: '>=14.17'}+ hasBin: true+ dev: true+resolution: {integrity: sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw==}engines: {node: '>=14.17'}