- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8 - Actualizaciones de configuracion Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
259 lines
5.4 KiB
YAML
259 lines
5.4 KiB
YAML
---
|
|
# DATABASE INVENTORY - Template SaaS
|
|
# Version: 3.0.0
|
|
# Ultima actualizacion: 2026-01-10
|
|
# Nota: Reestructuracion SIMCO v3.7 aplicada
|
|
|
|
metadata:
|
|
proyecto: "template-saas"
|
|
tipo: "DATABASE"
|
|
version: "3.0.0"
|
|
updated: "2026-01-10"
|
|
motor: "PostgreSQL 16+"
|
|
version_motor: "16.x"
|
|
estado: "completado"
|
|
|
|
features:
|
|
- "Row-Level Security (RLS)"
|
|
- "Multi-tenant isolation"
|
|
- "UUID primary keys"
|
|
- "JSONB for settings"
|
|
|
|
schemas:
|
|
- nombre: "auth"
|
|
descripcion: "Autenticacion y sesiones"
|
|
estado: "completado"
|
|
tablas:
|
|
- sessions
|
|
- tokens
|
|
- oauth_connections
|
|
enums:
|
|
- token_type
|
|
- oauth_provider
|
|
- session_status
|
|
funciones:
|
|
- cleanup_expired_sessions
|
|
- set_current_tenant
|
|
- get_current_tenant
|
|
- set_current_user
|
|
- get_current_user
|
|
- clear_context
|
|
rls_policies:
|
|
- sessions_tenant_isolation
|
|
- tokens_tenant_isolation
|
|
- oauth_tenant_isolation
|
|
|
|
- nombre: "tenants"
|
|
descripcion: "Multi-tenancy y organizaciones"
|
|
estado: "completado"
|
|
tablas:
|
|
- tenants
|
|
- tenant_settings
|
|
enums:
|
|
- tenant_status
|
|
- subscription_status
|
|
funciones:
|
|
- update_updated_at
|
|
rls_policies:
|
|
- tenant_settings_isolation
|
|
|
|
- nombre: "users"
|
|
descripcion: "Usuarios, roles y permisos"
|
|
estado: "completado"
|
|
tablas:
|
|
- users
|
|
- roles
|
|
- invitations
|
|
enums:
|
|
- user_status
|
|
- invitation_status
|
|
funciones:
|
|
- update_updated_at
|
|
- expire_old_invitations
|
|
rls_policies:
|
|
- users_tenant_isolation
|
|
- roles_tenant_isolation
|
|
- invitations_tenant_isolation
|
|
|
|
- nombre: "plans"
|
|
descripcion: "Planes y limites"
|
|
estado: "completado"
|
|
tablas:
|
|
- plans
|
|
funciones:
|
|
- get_tenant_limits
|
|
- check_limit
|
|
- get_tenant_features
|
|
- has_feature
|
|
rls_policies: []
|
|
|
|
- nombre: "billing"
|
|
descripcion: "Suscripciones, facturas y pagos"
|
|
estado: "completado"
|
|
tablas:
|
|
- subscriptions
|
|
- invoices
|
|
- payment_methods
|
|
enums:
|
|
- payment_status
|
|
- invoice_status
|
|
- billing_interval
|
|
- payment_method_type
|
|
- subscription_status
|
|
funciones:
|
|
- generate_invoice_number
|
|
rls_policies:
|
|
- subscriptions_tenant_isolation
|
|
- invoices_tenant_isolation
|
|
- payments_tenant_isolation
|
|
|
|
- nombre: "notifications"
|
|
descripcion: "Sistema de notificaciones v2"
|
|
estado: "completado"
|
|
tablas:
|
|
- notifications
|
|
- extended_notifications
|
|
enums:
|
|
- channel
|
|
- notification_status
|
|
- priority
|
|
- queue_status
|
|
- device_type
|
|
funciones:
|
|
- update_updated_at
|
|
rls_policies:
|
|
- notifications_tenant_isolation
|
|
- user_preferences_tenant_isolation
|
|
|
|
- nombre: "feature_flags"
|
|
descripcion: "Feature toggles"
|
|
estado: "completado"
|
|
tablas:
|
|
- flags
|
|
enums:
|
|
- flag_status
|
|
- rollout_stage
|
|
funciones:
|
|
- evaluate_flag
|
|
rls_policies:
|
|
- tenant_flags_isolation
|
|
- user_flags_isolation
|
|
|
|
- nombre: "audit"
|
|
descripcion: "Auditoria y logs"
|
|
estado: "completado"
|
|
tablas:
|
|
- audit_logs
|
|
enums:
|
|
- action_type
|
|
- severity
|
|
funciones:
|
|
- log_event
|
|
- cleanup_old_logs
|
|
rls_policies:
|
|
- audit_logs_tenant_isolation
|
|
|
|
- nombre: "storage"
|
|
descripcion: "Almacenamiento de archivos"
|
|
estado: "completado"
|
|
tablas:
|
|
- files
|
|
- storage_usage
|
|
enums:
|
|
- file_status
|
|
- visibility
|
|
- storage_provider
|
|
funciones:
|
|
- update_storage_usage
|
|
rls_policies:
|
|
- files_tenant_isolation
|
|
- storage_usage_tenant_isolation
|
|
|
|
- nombre: "ai"
|
|
descripcion: "Integracion AI"
|
|
estado: "completado"
|
|
tablas:
|
|
- ai_configs
|
|
- ai_usage
|
|
enums:
|
|
- ai_provider
|
|
- ai_model_type
|
|
- usage_status
|
|
funciones:
|
|
- track_ai_usage
|
|
rls_policies:
|
|
- ai_configs_tenant_isolation
|
|
- ai_usage_tenant_isolation
|
|
|
|
- nombre: "webhooks"
|
|
descripcion: "Webhooks outbound"
|
|
estado: "completado"
|
|
tablas:
|
|
- webhooks
|
|
- deliveries
|
|
enums:
|
|
- delivery_status
|
|
- event_type
|
|
funciones:
|
|
- retry_webhook
|
|
- get_webhook_stats
|
|
rls_policies:
|
|
- webhooks_tenant_isolation
|
|
- deliveries_tenant_isolation
|
|
|
|
- nombre: "whatsapp"
|
|
descripcion: "WhatsApp Business API"
|
|
estado: "completado"
|
|
tablas:
|
|
- whatsapp_configs
|
|
- whatsapp_messages
|
|
enums:
|
|
- message_status
|
|
- message_type
|
|
- message_direction
|
|
funciones: []
|
|
rls_policies:
|
|
- whatsapp_configs_tenant_isolation
|
|
- whatsapp_messages_tenant_isolation
|
|
|
|
resumen:
|
|
total_schemas: 12
|
|
total_tablas: 26
|
|
total_enums: 32
|
|
total_funciones: 25
|
|
total_rls_policies: 24
|
|
total_indices: 45
|
|
|
|
planificado:
|
|
tablas_actuales: 26
|
|
tablas_objetivo: 26
|
|
estado: "100%"
|
|
|
|
ddl_structure:
|
|
base_files:
|
|
- "00-extensions.sql"
|
|
- "01-schemas.sql"
|
|
- "02-enums.sql"
|
|
- "03-functions.sql"
|
|
schema_files:
|
|
- "schemas/*/tables/*.sql"
|
|
- "schemas/*/rls/*.sql"
|
|
- "schemas/*/triggers/*.sql"
|
|
|
|
seeds:
|
|
prod:
|
|
- plans: 4
|
|
- permissions: 21
|
|
- feature_flags: 8
|
|
- notification_templates: 6
|
|
dev:
|
|
- sample_tenants: 3
|
|
- sample_users: 10
|
|
|
|
scripts:
|
|
- create-database.sh
|
|
- drop-and-recreate.sh
|
|
|
|
ultima_actualizacion: "2026-01-10"
|
|
actualizado_por: "Claude Code (Estandarizacion SIMCO v3.7)"
|