mirror of
https://github.com/Anil-matcha/Open-Generative-AI.git
synced 2026-05-07 01:17:18 +00:00
First slice of the CSV-driven batch video-generation feature. Introduces the four-table schema (trainers, studios, batches, jobs) that the worker and new /batch UI will operate on, plus the infrastructure glue so the schema can be applied locally and in the docker-compose stack. - prisma/schema.prisma: Trainer, Studio, Batch, Job models with the indexes the worker's claim query will need ([batchId, status] and [status, nextAttemptAt]). - prisma/migrations/20260423011041_init_batch_schema: initial migration generated and applied against the compose Postgres. - lib/prisma.js: standard Next.js PrismaClient singleton, reused across the web API routes and the worker process. - docker-compose.yml: map Postgres to host port 5433 to avoid colliding with a pre-existing local Postgres on 5432; wire MUAPI_API_KEY env through web and worker; add uploads_data volume mounted at /data/uploads for slice-2 trainer/studio image backups. - .env.example: documented DATABASE_URL (5433 for host, 5432 for in-compose) and MUAPI_API_KEY placeholders. - .gitignore: ignore /data/uploads/ now so future runtime uploads don't end up tracked. Also downgraded prisma from 7.x to ^6 since 7 moved datasource config out of schema.prisma into a separate prisma.config.ts (breaking change we don't need to absorb yet). No API routes, worker, or UI in this slice — those land in the next branches (feat/trainers-studios-crud, feat/batch-create-csv, etc).
15 lines
350 B
JavaScript
15 lines
350 B
JavaScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const globalForPrisma = globalThis;
|
|
|
|
export const prisma =
|
|
globalForPrisma.prisma ??
|
|
new PrismaClient({
|
|
log: process.env.NODE_ENV === 'development' ? ['warn', 'error'] : ['error'],
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
globalForPrisma.prisma = prisma;
|
|
}
|
|
|
|
export default prisma;
|