[CRIT-002] feat(ddl): Add public.set_updated_at() function

Create missing trigger function required by MLM schema triggers.
The function updates the updated_at column to CURRENT_TIMESTAMP
on row updates for mlm.structures, mlm.ranks, and mlm.nodes tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adrian Flores Cortes 2026-02-03 17:17:16 -06:00
parent f30b672e92
commit 0d3e0228f4

View File

@ -162,6 +162,22 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
-- =============================================================================
-- FUNCION: public.set_updated_at()
-- Trigger function para actualizar columna updated_at automaticamente
-- Usada por: mlm.structures, mlm.ranks, mlm.nodes (schema mlm)
-- Nota: Equivalente a update_updated_at_column() - mantener ambas por compatibilidad
-- =============================================================================
CREATE OR REPLACE FUNCTION public.set_updated_at()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = CURRENT_TIMESTAMP;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
COMMENT ON FUNCTION public.set_updated_at() IS 'Trigger function que actualiza automaticamente la columna updated_at al timestamp actual';
-- Create AI configs updated_at trigger (table defined in schemas/ai/)
DO $$
BEGIN