Add: 260118_sesion_fk_completas.md - FK completas TZZR
This commit is contained in:
136
sesiones/260118_sesion_fk_completas.md
Normal file
136
sesiones/260118_sesion_fk_completas.md
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
# Sesión 260118 - Foreign Keys Completas TZZR
|
||||||
|
|
||||||
|
## Resumen
|
||||||
|
Creación masiva de FK en base de datos TZZR (DECK) y HST para garantizar integridad referencial.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. FK set_hst → hst.mrf (8 nuevas)
|
||||||
|
|
||||||
|
Tablas que ahora tienen FK a hst:
|
||||||
|
| Schema | Tabla |
|
||||||
|
|--------|-------|
|
||||||
|
| tzzr_communications | chat, mail |
|
||||||
|
| tzzr_core_administracion | administracion_bck, administracion_mst |
|
||||||
|
| tzzr_core_contabilidad | contabilidad_bck, contabilidad_mst |
|
||||||
|
| tzzr_core_hst | flg, hst (self-ref) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. FK graph/library/tree (48 nuevas en DECK)
|
||||||
|
|
||||||
|
### tzzr_core_hst (ya existían)
|
||||||
|
- graph_hst, library_hst, tree_hst → hst.mrf
|
||||||
|
|
||||||
|
### tzzr_core_itm_base (12 FK)
|
||||||
|
- graph_itm, library_itm, tree_itm → itm.mrf
|
||||||
|
- graph_loc, library_loc, tree_loc → loc.mrf
|
||||||
|
- graph_ply, library_ply, tree_ply → ply.mrf
|
||||||
|
|
||||||
|
### tzzr_core_produccion (6 FK)
|
||||||
|
- graph_mth, library_mth, tree_mth → mth.mrf
|
||||||
|
|
||||||
|
### tzzr_storage (6 FK)
|
||||||
|
- graph_atc, library_atc, tree_atc → atc.mrf
|
||||||
|
|
||||||
|
### tzzr_core_administracion (12 FK)
|
||||||
|
- graph_mst/bck, library_mst/bck, tree_mst/bck → administracion_mst/bck.mrf
|
||||||
|
|
||||||
|
### tzzr_core_contabilidad (12 FK)
|
||||||
|
- graph_mst/bck, library_mst/bck, tree_mst/bck → contabilidad_mst/bck.mrf
|
||||||
|
|
||||||
|
### tzzr_core_secretaria (12 FK)
|
||||||
|
- graph_mst/bck, library_mst/bck, tree_mst/bck → secretaria_mst/bck.mrf
|
||||||
|
|
||||||
|
### tzzr_core_oracle (12 FK)
|
||||||
|
- graph_mst/bck, library_mst/bck, tree_mst/bck → oracle_mst.mrf
|
||||||
|
- Nota: oracle no tiene _bck principal, todas apuntan a oracle_mst
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Trabajo en HST
|
||||||
|
|
||||||
|
### FK creadas
|
||||||
|
- 54 FK nuevas en schemas public, tzzr_core_hst, tzzr_core_itm_base
|
||||||
|
|
||||||
|
### Datos huérfanos encontrados y eliminados
|
||||||
|
| Tabla | Registros | Descripción |
|
||||||
|
|-------|-----------|-------------|
|
||||||
|
| tzzr_core_itm_base.itm | 1 | set_hst='cualquier_hst_nuevo' (test) |
|
||||||
|
| public.library_ply | 940 | mrf_tag huérfano |
|
||||||
|
| tzzr_core_itm_base.library_ply | 940 | mrf_child huérfano |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Limpieza realizada
|
||||||
|
|
||||||
|
### DECK
|
||||||
|
- library_ply: 940 registros huérfanos eliminados (mrf_child inválido)
|
||||||
|
- Backup disponible: `260117_postgres_full_backup_202344.sql` en Nextcloud
|
||||||
|
|
||||||
|
### HST
|
||||||
|
- Filebrowser desinstalado completamente
|
||||||
|
- Endpoint filebrowser eliminado de tzzr_system.endpoints
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Tablas endpoints
|
||||||
|
|
||||||
|
| Servidor | Registros | Estado |
|
||||||
|
|----------|-----------|--------|
|
||||||
|
| DECK | 14 | ✓ |
|
||||||
|
| HST | 6 | ✓ (sin filebrowser) |
|
||||||
|
| ARCHITECT | 7 | ✓ |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Schema mapeado creado
|
||||||
|
|
||||||
|
```sql
|
||||||
|
CREATE SCHEMA mapeado;
|
||||||
|
-- Para futuras tablas de mapeo de datos legacy
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Herramientas nativas Nextcloud
|
||||||
|
|
||||||
|
Eliminado rclone, creados scripts nativos:
|
||||||
|
- `~/bin/nc-upload` - Subir archivos via WebDAV
|
||||||
|
- `~/bin/nc-list` - Listar carpetas via WebDAV
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Documentación agente curador
|
||||||
|
|
||||||
|
Creado spec: `agentes/260118_agente_curador_hashtags.md`
|
||||||
|
- Para futura migración de hashtags legacy (228 tags, 2747 usos)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Conteo final FK en DECK
|
||||||
|
|
||||||
|
| Categoría | Cantidad |
|
||||||
|
|-----------|----------|
|
||||||
|
| FK directus (sistema) | 43 |
|
||||||
|
| FK TZZR (propias) | ~110 |
|
||||||
|
| **Total** | ~153 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pendiente
|
||||||
|
|
||||||
|
1. Triggers para validar set_hst contra hst_rules
|
||||||
|
2. Migración hashtags legacy (proceso manual largo)
|
||||||
|
3. Reporte de datos eliminados para investigación
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Archivos generados esta sesión
|
||||||
|
|
||||||
|
| Archivo | Ubicación |
|
||||||
|
|---------|-----------|
|
||||||
|
| 260118_sesion_hashtags_mapeado.md | sesiones/ |
|
||||||
|
| 260118_tareas_tablas.md | tareas/ |
|
||||||
|
| 260118_agente_curador_hashtags.md | agentes/ |
|
||||||
|
| 260118_sesion_fk_completas.md | sesiones/ |
|
||||||
Reference in New Issue
Block a user