Files
metabuilder/prisma
rmac 01de695619 Set up database seeding architecture and E2E testing infrastructure
- Add CLAUDE.md: AI assistant instructions for MetaBuilder project architecture
- Add TESTING.md: Comprehensive E2E testing guide and troubleshooting

Core changes:
- Create Playwright global.setup.ts to seed database before E2E tests
- Add /api/setup endpoint to trigger database seeding via HTTP
- Implement seed-home-page.ts module loaded from ui_home package metadata
- Create ui_home/seed/metadata.json defining home page PageConfig seed data

Architecture established:
- Packages define seed data in seed/metadata.json
- Seed functions are idempotent (check before creating)
- Global setup calls /api/setup before running tests
- Database schema must be created via 'npm run db:push' before seeding

Test flow:
1. Playwright starts webServer (generates Prisma client, starts Next.js)
2. Global setup waits for server, calls POST /api/setup
3. Seeding creates default data from packages
4. E2E tests run against seeded database

This establishes proper separation of concerns:
- DBAL adapter for database access (not raw Prisma)
- Package-driven seed data (not hardcoded in code)
- HTTP endpoint for explicit database initialization
- Idempotent seeds (safe to rerun)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-14 18:15:46 +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