Fix: Usar clock_timestamp() en trigger updated_at para garantizar timestamps únicos

- Cambiar now() por clock_timestamp() en función set_updated_at()
- now() retorna el timestamp del inicio de la transacción
- clock_timestamp() retorna el timestamp actual del sistema
- Garantiza que cada UPDATE tenga un timestamp diferente
- Mejora la precisión para auditoría de cambios
This commit is contained in:
2025-10-17 17:56:51 -06:00
parent cc3cf0da81
commit 8ec394a74e

View File

@@ -8,7 +8,7 @@
CREATE OR REPLACE FUNCTION set_updated_at() CREATE OR REPLACE FUNCTION set_updated_at()
RETURNS trigger LANGUAGE plpgsql AS $$ RETURNS trigger LANGUAGE plpgsql AS $$
BEGIN BEGIN
NEW.updated_at := now(); NEW.updated_at := clock_timestamp();
RETURN NEW; RETURN NEW;
END $$; END $$;