generator client { provider = "prisma-client-js" } datasource db { provider = "postgresql" url = env("DATABASE_URL") } model Tenant { id String @id @default(uuid()) nombre String rfc String @unique plan Plan @default(starter) schemaName String @unique @map("schema_name") cfdiLimit Int @map("cfdi_limit") usersLimit Int @map("users_limit") active Boolean @default(true) createdAt DateTime @default(now()) @map("created_at") expiresAt DateTime? @map("expires_at") users User[] @@map("tenants") } model User { id String @id @default(uuid()) tenantId String @map("tenant_id") email String @unique passwordHash String @map("password_hash") nombre String role Role @default(visor) active Boolean @default(true) lastLogin DateTime? @map("last_login") createdAt DateTime @default(now()) @map("created_at") tenant Tenant @relation(fields: [tenantId], references: [id]) @@map("users") } model RefreshToken { id String @id @default(uuid()) userId String @map("user_id") token String @unique expiresAt DateTime @map("expires_at") createdAt DateTime @default(now()) @map("created_at") @@map("refresh_tokens") } enum Plan { starter business professional enterprise } enum Role { admin contador visor }