Some checks are pending
CI/CD Pipeline / Backend CI (push) Waiting to run
CI/CD Pipeline / Frontend CI (push) Waiting to run
CI/CD Pipeline / WhatsApp Service CI (push) Waiting to run
CI/CD Pipeline / Mobile CI (push) Waiting to run
CI/CD Pipeline / Docker Build (./apps/backend, ./apps/backend/Dockerfile, backend) (push) Blocked by required conditions
CI/CD Pipeline / Docker Build (./apps/frontend, ./apps/frontend/Dockerfile, frontend) (push) Blocked by required conditions
CI/CD Pipeline / Docker Build (./apps/whatsapp-service, ./apps/whatsapp-service/Dockerfile, whatsapp-service) (push) Blocked by required conditions
CI/CD Pipeline / Deploy to Production (push) Blocked by required conditions
- Move 7 non-standard folders to _archive/ - Archive 3 extra root files - Update _MAP.md with standardized structure Standard: SIMCO-ESTANDAR-ORCHESTRATION v1.0.0 Level: CONSUMER (L2) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
190 lines
6.1 KiB
Markdown
190 lines
6.1 KiB
Markdown
# ANALISIS DE INTEGRACION: ARQUITECTURA-DATABASE.md
|
|
|
|
**Fecha:** 2026-01-10
|
|
**Proposito:** Analisis detallado antes de integrar/eliminar archivos duplicados
|
|
|
|
---
|
|
|
|
## 1. ARCHIVOS ANALIZADOS
|
|
|
|
| Archivo | Ubicacion | Lineas | Fecha |
|
|
|---------|-----------|--------|-------|
|
|
| ARQUITECTURA-DATABASE.md (RESUMEN) | docs/90-transversal/arquitectura/ | 163 | 2026-01-05 |
|
|
| ARQUITECTURA-DATABASE.md (COMPLETO) | docs/02-especificaciones/ | 1182 | 2026-01-04 |
|
|
|
|
---
|
|
|
|
## 2. COMPARACION DETALLADA DE CONTENIDO
|
|
|
|
### 2.1 Archivo RESUMEN (90-transversal/arquitectura/) - 163 lineas
|
|
|
|
| Seccion | Lineas | Contenido |
|
|
|---------|--------|-----------|
|
|
| Resumen | 7-15 | Metricas: Motor, Schemas, Tablas, Extensiones |
|
|
| Schemas | 18-31 | Tabla con 9 schemas y descripcion |
|
|
| Estructura por Schema | 34-97 | Nombres de tablas por schema (SIN SQL) |
|
|
| Extensiones | 100-107 | Lista de 4 extensiones |
|
|
| Multi-tenancy | 110-116 | Descripcion breve (tenant_id, indices, trigger) |
|
|
| **Convenciones** | **119-136** | **CONTENIDO UNICO - Columnas comunes, indices, triggers** |
|
|
| Conexion | 139-146 | Host, puerto, database, usuario |
|
|
| Scripts | 150-156 | Referencias a scripts |
|
|
| Referencias | 159-162 | Links a otros documentos |
|
|
|
|
### 2.2 Archivo COMPLETO (02-especificaciones/) - 1182 lineas
|
|
|
|
| Seccion | Lineas | Contenido |
|
|
|---------|--------|-----------|
|
|
| Resumen | 3-9 | Motor, puerto, BD, usuario, arquitectura |
|
|
| Schemas | 13-26 | Tabla con 9 schemas |
|
|
| Schema public | 29-123 | **SQL COMPLETO**: tenants, tenant_configs |
|
|
| Schema auth | 127-217 | **SQL COMPLETO**: users, sessions, otp_codes |
|
|
| Schema catalog | 221-336 | **SQL COMPLETO**: categories, products, product_templates + RLS |
|
|
| Schema sales | 340-518 | **SQL COMPLETO**: sales, sale_items, payments, daily_closures |
|
|
| Schema inventory | 522-586 | **SQL COMPLETO**: inventory_movements, stock_alerts |
|
|
| Schema customers | 590-698 | **SQL COMPLETO**: customers, fiados, fiado_payments + RLS |
|
|
| Schema orders | 702-785 | **SQL COMPLETO**: orders, order_items |
|
|
| Schema subscriptions | 789-952 | **SQL COMPLETO**: plans, subscriptions, token_packages, token_usage, tenant_token_balance |
|
|
| Schema messaging | 957-1065 | **SQL COMPLETO**: conversations, messages, notifications |
|
|
| Funciones Utiles | 1069-1139 | generate_ticket_number, update_updated_at, update_customer_fiado_balance |
|
|
| Indices Performance | 1143-1158 | Indices adicionales para reportes |
|
|
| Row Level Security | 1163-1176 | Configuracion RLS general |
|
|
|
|
---
|
|
|
|
## 3. CONTENIDO UNICO POR ARCHIVO
|
|
|
|
### 3.1 Contenido UNICO en RESUMEN (a preservar)
|
|
|
|
**Seccion "Convenciones" (lineas 119-136):**
|
|
```markdown
|
|
## Convenciones
|
|
|
|
### Columnas Comunes
|
|
- `id`: UUID PRIMARY KEY
|
|
- `tenant_id`: UUID NOT NULL (multi-tenant)
|
|
- `created_at`: TIMESTAMPTZ DEFAULT NOW()
|
|
- `updated_at`: TIMESTAMPTZ DEFAULT NOW()
|
|
- `is_active`: BOOLEAN DEFAULT TRUE
|
|
|
|
### Indices
|
|
- PK en `id`
|
|
- Indice en `tenant_id`
|
|
- Indices en FKs
|
|
- Indices en columnas de busqueda frecuente
|
|
|
|
### Triggers
|
|
- `set_updated_at`: Actualiza `updated_at` automaticamente
|
|
```
|
|
|
|
**Seccion "Conexion" (lineas 139-146):**
|
|
```markdown
|
|
## Conexion
|
|
|
|
Host: localhost (dev)
|
|
Puerto: 5432
|
|
Database: michangarrito_dev
|
|
Usuario: michangarrito_dev
|
|
```
|
|
|
|
**Seccion "Scripts" (lineas 150-156):**
|
|
```markdown
|
|
## Scripts
|
|
|
|
| Script | Descripcion |
|
|
|--------|-------------|
|
|
| `database/scripts/create-database.sh` | Crear BD desde cero |
|
|
| `database/scripts/recreate-database.sh` | Recrear BD (destructivo) |
|
|
```
|
|
|
|
**Seccion "Referencias" (lineas 159-162):**
|
|
```markdown
|
|
## Referencias
|
|
|
|
- [Environment Inventory](../../orchestration/environment/ENVIRONMENT-INVENTORY.yml)
|
|
- [Contexto del Proyecto](../../orchestration/00-guidelines/CONTEXTO-PROYECTO.md)
|
|
```
|
|
|
|
### 3.2 Contenido UNICO en COMPLETO (ya presente)
|
|
|
|
- SQL completo de todas las tablas (CREATE TABLE)
|
|
- Politicas RLS implementadas
|
|
- Funciones PostgreSQL
|
|
- Triggers implementados
|
|
- Indices de performance
|
|
- INSERT de datos seed (plans, token_packages)
|
|
|
|
---
|
|
|
|
## 4. CONTENIDO DUPLICADO (85%)
|
|
|
|
| Tema | En RESUMEN | En COMPLETO | Veredicto |
|
|
|------|------------|-------------|-----------|
|
|
| Lista de schemas | Si (tabla) | Si (tabla) | DUPLICADO - Mantener COMPLETO |
|
|
| Nombres de tablas | Si (lista) | Si (con SQL) | DUPLICADO - Mantener COMPLETO |
|
|
| Extensiones | Si (lista) | No | UNICO RESUMEN - Integrar |
|
|
| Multi-tenancy | Si (breve) | Si (RLS completo) | DUPLICADO - Mantener COMPLETO |
|
|
|
|
---
|
|
|
|
## 5. REFERENCIAS A ACTUALIZAR
|
|
|
|
### 5.1 Referencias Activas al Archivo RESUMEN
|
|
|
|
| Archivo | Linea | Referencia Actual | Nueva Referencia |
|
|
|---------|-------|-------------------|------------------|
|
|
| orchestration/PLAN-IMPLEMENTACION.md | 329 | `../docs/90-transversal/arquitectura/ARQUITECTURA-DATABASE.md` | `../docs/02-especificaciones/ARQUITECTURA-DATABASE.md` |
|
|
| docs/02-especificaciones/ESPECIFICACION-COMPONENTES.md | ? | `../90-transversal/arquitectura/ARQUITECTURA-DATABASE.md` | `./ARQUITECTURA-DATABASE.md` |
|
|
|
|
---
|
|
|
|
## 6. PLAN DE INTEGRACION
|
|
|
|
### Paso 1: Integrar contenido unico al archivo COMPLETO
|
|
|
|
**Agregar al final de 02-especificaciones/ARQUITECTURA-DATABASE.md:**
|
|
|
|
1. Seccion "Extensiones" (si no existe)
|
|
2. Seccion "Convenciones"
|
|
3. Seccion "Conexion"
|
|
4. Seccion "Scripts"
|
|
5. Seccion "Referencias"
|
|
|
|
### Paso 2: Actualizar referencias
|
|
|
|
1. PLAN-IMPLEMENTACION.md: Cambiar ruta
|
|
2. ESPECIFICACION-COMPONENTES.md: Cambiar ruta
|
|
|
|
### Paso 3: Eliminar archivo duplicado
|
|
|
|
1. Eliminar: docs/90-transversal/arquitectura/ARQUITECTURA-DATABASE.md
|
|
2. Eliminar carpeta si queda vacia: docs/90-transversal/arquitectura/
|
|
|
|
---
|
|
|
|
## 7. VALIDACION PRE-INTEGRACION
|
|
|
|
### Checklist
|
|
|
|
- [x] Identificado contenido unico a preservar
|
|
- [x] Identificadas referencias a actualizar (2 archivos)
|
|
- [x] Plan de integracion definido
|
|
- [ ] Ejecutar integracion de contenido
|
|
- [ ] Actualizar referencias
|
|
- [ ] Validar que no hay referencias rotas
|
|
- [ ] Eliminar duplicado
|
|
|
|
---
|
|
|
|
## 8. IMPACTO EN FUNCIONALIDADES
|
|
|
|
| Funcionalidad | Impacto | Mitigacion |
|
|
|---------------|---------|------------|
|
|
| Documentacion BD | NINGUNO | Contenido se preserva completo |
|
|
| Links en docs | BAJO | Se actualizan 2 referencias |
|
|
| Navegacion | MEJORA | Una sola fuente de verdad |
|
|
|
|
---
|
|
|
|
**Estado:** LISTO PARA EJECUTAR INTEGRACION
|
|
**Aprobacion requerida:** Si
|