[GAP-007] fix: Remove non-immutable generated column in change_log

PostgreSQL requires generated columns to use immutable expressions.
The executed_at::date cast is not immutable due to timezone dependencies.
Changed to a regular DATE column that can be populated by the trigger.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Adrian Flores Cortes 2026-02-04 01:35:04 -06:00
parent efce73bdbd
commit a05f7595b4

View File

@ -60,8 +60,8 @@ CREATE TABLE IF NOT EXISTS audit.change_log (
-- Timestamp
executed_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
-- Para queries eficientes
executed_date DATE GENERATED ALWAYS AS (executed_at::date) STORED
-- Para queries eficientes (calculado, no generado - por compatibilidad)
executed_date DATE
);
-- Índices para change_log