Mejora migraciones con tabla de versiones

This commit is contained in:
2026-02-17 17:22:20 +01:00
parent 8427613114
commit 459523666f
7 changed files with 187 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS order_tracking (
start_date TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc'),
update_date TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc'),
finish_date TIMESTAMP
)
);
-- Busqueda según id de rabbit
CREATE INDEX IF NOT EXISTS idx_order_correlation
@@ -40,7 +40,7 @@ CREATE INDEX IF NOT EXISTS pending_orders
WHERE order_tracking.finish_date IS NULL;
CREATE TABLE IF NOT EXISTS order_history(
id SERIAL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
order_id BIGINT NOT NULL,
previous_status order_status NOT NULL, -- Siempre hay un estado anterior, para casos excepcioneale "unknown"
new_status order_status NOT NULL,