mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 14:25:02 +00:00
- 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>
21 lines
461 B
Bash
21 lines
461 B
Bash
#!/bin/bash
|
|
# Database setup script for development and testing
|
|
|
|
set -e
|
|
|
|
DB_FILE="../../prisma/prisma/dev.db"
|
|
|
|
# Generate Prisma client
|
|
echo "Generating Prisma client..."
|
|
npm run db:generate
|
|
|
|
# Push schema to database using proper environment configuration
|
|
echo "Creating database schema..."
|
|
cd ../../prisma
|
|
export DATABASE_URL="file:prisma/dev.db"
|
|
|
|
# Use npx to run prisma with proper env var
|
|
npx prisma db push --skip-generate
|
|
|
|
echo "Database setup complete"
|