Files
metabuilder/prisma
copilot-swe-agent[bot] 96ee74e6ef MAJOR FIX: Correct Prisma 7 adapter usage - use factory pattern with URL config
The root cause was incorrect adapter usage:
- PrismaBetterSqlite3 is a FACTORY that expects {url: string} config
- We were incorrectly passing a Database instance directly
- This caused "Cannot read properties of undefined (reading 'replace')" error

Changes:
1. Fixed Next.js prisma.ts to pass {url} config to adapter factory
2. Fixed DBAL context.ts to use adapter factory with URL
3. Removed direct Database instantiation - let adapter handle it
4. Created absolute-path .env file with DATABASE_URL
5. Cleaned and reinstalled all dependencies to ensure version alignment
6. Added missing database columns (tenantId, config to InstalledPackage)

Result: Database operations now work! Application serves pages successfully.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2026-01-08 05:01:39 +00:00
..

Prisma Database Configuration

This directory contains the Prisma database schema and migrations. The schema is generated from DBAL and should not be edited manually.

📋 Files

  • schema.prisma - Database schema definition
  • migrations/ - Database migration history

🚀 Quick Start

Generate Prisma Client

npm --prefix dbal/development run codegen:prisma
npm run db:generate

Regenerate the Prisma client after schema changes.

Apply Migrations

npm run db:push

Apply pending schema changes to database.

View Database

npm run db:studio

Opens Prisma Studio for visual database management.

📝 Database Schema

Key entities defined in schema.prisma:

  • User - Core user identity
  • Credential - Authentication hashes
  • Session - Active sessions
  • PageConfig - Routes and page metadata
  • ComponentNode - Component tree nodes
  • ComponentConfig - Component configuration payloads
  • Workflow - Automation workflows
  • InstalledPackage - Installed package metadata
  • PackageData - Package data payloads

📚 Migrations

Migration files track schema changes:

# List migrations
ls migrations/

# Create new migration
npx prisma migrate dev --name add_feature

# Reset database (dev only!)
npx prisma migrate reset