Files
metabuilder/prisma
copilot-swe-agent[bot] 37f48497a0 Update dependencies to latest versions and refactor API calls
- Updated Prisma from 6.19.1 to 7.2.0 (major version)
- Migrated Prisma schema to remove datasource URL (Prisma 7.x requirement)
- Updated PrismaClient initialization to pass datasourceUrl
- Fixed API route handlers to accept NextRequest parameter
- Updated MUI Grid component to include component prop for v7 compatibility
- Added AWS SDK dependencies to DBAL development module
- Created stub implementations for GitHub workflow log analysis functions

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-27 14:37:27 +00:00
..
2025-12-25 12:32:52 +00:00

Prisma Database Configuration

This directory contains the Prisma database schema and migrations.

📋 Files

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

🚀 Quick Start

Generate Prisma Client

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 - System users with permission levels
  • Tenant - Multi-tenant support
  • Package - Feature packages
  • Schema - Dynamic data schemas
  • Data - JSON data storage
  • LuaScript - Business logic scripts
  • Audit - Activity logging

User Levels

enum PermissionLevel {
  GUEST     // Level 1 (read-only)
  USER      // Level 2
  ADMIN     // Level 3
  GOD       // Level 4
  SUPERGOD  // Level 5 (system admin)
}

Sample Table

model User {
  id           String   @id @default(cuid())
  email        String   @unique
  password     String   // SHA-512 hash
  level        PermissionLevel
  tenantId     String
  createdAt    DateTime @default(now())
  updatedAt    DateTime @updatedAt
  
  tenant       Tenant   @relation(fields: [tenantId], references: [id])
}

🔒 Security

  • All passwords stored as SHA-512 hashes
  • Multi-tenant data isolation
  • Permission-based access control
  • Type-safe database queries

📚 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