Template base para proyectos SaaS multi-tenant. Estructura inicial: - apps/backend (NestJS API) - apps/frontend (React/Vite) - apps/database (PostgreSQL DDL) - docs/ (Documentación) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
195 lines
4.4 KiB
YAML
195 lines
4.4 KiB
YAML
---
|
|
# DATABASE INVENTORY - Template SaaS
|
|
# Version: 1.0.0
|
|
# Ultima actualizacion: 2026-01-07
|
|
|
|
proyecto: "template-saas"
|
|
estado: "en_desarrollo"
|
|
|
|
schemas:
|
|
- nombre: "auth"
|
|
descripcion: "Autenticacion y sesiones"
|
|
estado: "completado"
|
|
tablas:
|
|
- sessions
|
|
- tokens
|
|
- refresh_tokens
|
|
- oauth_connections
|
|
funciones:
|
|
- cleanup_expired_sessions
|
|
- set_current_tenant
|
|
- get_current_tenant
|
|
- set_current_user
|
|
- get_current_user
|
|
- clear_context
|
|
- update_updated_at
|
|
triggers:
|
|
- trg_oauth_updated_at
|
|
rls_policies:
|
|
- sessions_tenant_isolation
|
|
- tokens_tenant_isolation
|
|
- refresh_tokens_tenant_isolation
|
|
- oauth_tenant_isolation
|
|
|
|
- nombre: "tenants"
|
|
descripcion: "Multi-tenancy y organizaciones"
|
|
estado: "completado"
|
|
tablas:
|
|
- tenants
|
|
- tenant_settings
|
|
funciones:
|
|
- update_updated_at
|
|
triggers:
|
|
- trg_tenants_updated_at
|
|
- trg_tenant_settings_updated_at
|
|
rls_policies:
|
|
- tenant_settings_isolation
|
|
|
|
- nombre: "users"
|
|
descripcion: "Usuarios, roles y permisos"
|
|
estado: "completado"
|
|
tablas:
|
|
- users
|
|
- roles
|
|
- user_roles
|
|
- permissions
|
|
- invitations
|
|
funciones:
|
|
- update_updated_at
|
|
- expire_old_invitations
|
|
- count_active_users
|
|
- can_add_user
|
|
triggers:
|
|
- trg_users_updated_at
|
|
- trg_roles_updated_at
|
|
rls_policies:
|
|
- users_tenant_isolation_select
|
|
- users_tenant_isolation_insert
|
|
- users_tenant_isolation_update
|
|
- users_tenant_isolation_delete
|
|
- roles_tenant_isolation
|
|
- user_roles_tenant_isolation
|
|
- invitations_tenant_isolation
|
|
|
|
- nombre: "billing"
|
|
descripcion: "Suscripciones, facturas y pagos"
|
|
estado: "completado"
|
|
tablas:
|
|
- subscriptions
|
|
- subscription_items
|
|
- invoices
|
|
- invoice_items
|
|
- payments
|
|
funciones:
|
|
- update_updated_at
|
|
- generate_invoice_number
|
|
triggers:
|
|
- trg_subscriptions_updated_at
|
|
- trg_invoices_updated_at
|
|
- trg_payments_updated_at
|
|
rls_policies:
|
|
- subscriptions_tenant_isolation
|
|
- subscription_items_tenant_isolation
|
|
- invoices_tenant_isolation
|
|
- invoice_items_tenant_isolation
|
|
- payments_tenant_isolation
|
|
|
|
- nombre: "plans"
|
|
descripcion: "Planes y limites"
|
|
estado: "completado"
|
|
tablas:
|
|
- plans
|
|
- plan_features
|
|
funciones:
|
|
- update_updated_at
|
|
- get_tenant_limits
|
|
- check_limit
|
|
- get_tenant_features
|
|
- has_feature
|
|
triggers:
|
|
- trg_plans_updated_at
|
|
rls_policies: []
|
|
|
|
- nombre: "notifications"
|
|
descripcion: "Sistema de notificaciones"
|
|
estado: "completado"
|
|
tablas:
|
|
- templates
|
|
- notifications
|
|
- user_preferences
|
|
funciones:
|
|
- update_updated_at
|
|
triggers:
|
|
- trg_templates_updated_at
|
|
- trg_user_preferences_updated_at
|
|
rls_policies:
|
|
- notifications_tenant_isolation
|
|
- user_preferences_tenant_isolation
|
|
|
|
- nombre: "feature_flags"
|
|
descripcion: "Feature toggles"
|
|
estado: "completado"
|
|
tablas:
|
|
- flags
|
|
- tenant_flags
|
|
- user_flags
|
|
- evaluations
|
|
funciones:
|
|
- update_updated_at
|
|
- evaluate_flag
|
|
triggers:
|
|
- trg_flags_updated_at
|
|
- trg_tenant_flags_updated_at
|
|
- trg_user_flags_updated_at
|
|
rls_policies:
|
|
- tenant_flags_isolation
|
|
- user_flags_isolation
|
|
- evaluations_isolation
|
|
|
|
- nombre: "audit"
|
|
descripcion: "Auditoria y logs"
|
|
estado: "completado"
|
|
tablas:
|
|
- audit_logs
|
|
- activity_logs
|
|
funciones:
|
|
- log_event
|
|
- cleanup_old_logs
|
|
triggers: []
|
|
rls_policies:
|
|
- audit_logs_tenant_isolation
|
|
- activity_logs_tenant_isolation
|
|
|
|
- nombre: "storage"
|
|
descripcion: "Almacenamiento de archivos"
|
|
estado: "pendiente"
|
|
tablas: []
|
|
funciones: []
|
|
triggers: []
|
|
rls_policies: []
|
|
|
|
metricas:
|
|
total_schemas: 9
|
|
total_tablas: 28
|
|
total_funciones: 22
|
|
total_triggers: 14
|
|
total_rls_policies: 20
|
|
|
|
planificado:
|
|
tablas_estimadas: 35
|
|
funciones_estimadas: 25
|
|
triggers_estimados: 20
|
|
rls_policies_estimadas: 35
|
|
|
|
seeds:
|
|
prod:
|
|
- plans (4 planes)
|
|
- permissions (21 permisos)
|
|
- feature_flags (8 flags)
|
|
- notification_templates (6 templates)
|
|
dev:
|
|
- pendiente
|
|
|
|
ultima_actualizacion: "2026-01-07"
|
|
actualizado_por: "Orquestador"
|