// backend/prisma/schema.prisma datasource db { provider = "sqlite" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" } model App { id Int @id @default(autoincrement()) title String? prompt String html String? denoCode String? // New field for Deno backend code state AppState @default(INITIALIZING) backendState BackendState @default(STOPPED) // New field for backend status backendPort Int? // New field for the port the backend runs on numChars Int @default(0) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt published Boolean @default(false) lightningAddress String? nwcUrl String? nsec String? ppqApiKey String? editKey String @default(uuid()) previewKey String @default(uuid()) errorMessage String? // Add field to store error messages promptSuggestions String? // Add field to store prompt suggestions generatingSection String? systemPrompt String? systemPromptSegmentNames String? seed Int? zaps Zap[] // Relation to Zaps zapAmount Int @default(0) // Net zap amount (sats) fullOutput String? model String @default("deepseek/deepseek-chat:free") subdomain String? @unique // New field for subdomain } enum AppState { INITIALIZING GENERATING REVIEWING // Add state for title/suggestion generation COMPLETED FAILED } // New enum for backend process state enum BackendState { STOPPED STARTING RUNNING STOPPING FAILED_TO_START } model Zap { id Int @id @default(autoincrement()) appId Int app App @relation(fields: [appId], references: [id]) amount Int // Store amount in sats type ZapType comment String? // Optional user comment invoice String @unique // BOLT11 invoice paid Boolean @default(false) createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@index([appId]) } enum ZapType { UPZAP DOWNZAP }